Good evening folks,
I have the following code, working fine in SQL Management Studio.
While trying to execute the code through a bat file with the follwoing code
@echo onosql -S servername-U username -P pw <Update_guenstigster_Artikel.sqlpause
I am getting the error message
C:Path>osql -S servername -U username -P password 0<filename.sql 1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 2 3> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 4 3> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 6 3> 64> 65> 66> 67> 68> 69> 70> 71> 72> 73> 74> 75> 76> 77> 78> 79> 80> 81> 82> 8 3> 84> 85> 86> 87> 88> 89> 90> 91> 92> 93> 94> 95> 96> 97> 98> 99> 100> 101> 102> 103> 104> 105> 106> 107> 108> 109> 110> 111> 112> 113> 114> 115> 116> 117> 118> 119> 120> 121> 122> 123> 124> 125> 126> 127> 128> 129> 130> 131> 132> 133> 134> 135> 136> 137> 138> 139> 140> 141> 142> 143> 144> 145> 146> 147> 148> 149> 150> 151> 152> 153> 154> 155> 156> 157> 158> 159> 160> 161> 162> 163> 164> 165> 166> 167> 168> 169> 170> 171> 172> 173> 174> 175> 176> 177> 178> 179> 180> 181> 182> 183> 184> 185> 186> 187> 188> 189> 190> 191> 192> 193> 194> 195> 196> 197> 198> 199> 200> 201> Meldung '1934', Ebene '16', Status '1', Server 'servername ', Zeile 48 Fehler bei SELECT, da die folgenden SET-Optionen falsche Einstellungen aufweisen: 'QUOTED_IDENTIFIER'. Überprüfen Sie, ob die SET-Optionen für die Verwendung mit indizierte Sichten und/oder Indizes für berechnete Spalten und/oder gefilterte Indizes und/oder Abfragebenachrichtigungen und/oder XML-Datentypmethoden und/oder Vorgänge für räumliche Indizes richtig sind. 1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 2 3> 24> 25> 26> C:\Tekfreak\Batchfiles>pause Drücken Sie eine beliebige Taste . . .
the SQL file is looking like this:
USE master; DECLARE @Importvorlage int = 9; -- Enter the Value of the Importvorlage which parameter will be used /* ### SPLIT Price PARAMETER ### */ if OBJECT_ID('tempdb..#param1') is not null BEGIN; DROP TABLE #param1; END; Create TABLE #param1 ( minvalue varchar(10), maxvalue varchar(10), operator varchar(10), multiplicator varchar(10) ); DECLARE @S1 varchar(max), @Split1 char(1), @Split21 char(1), @Split31 char(1), @y1 varchar(max), @X1 xml, @Z1 int = 1, @11 varchar(10), @21 varchar(10), @31 varchar(10), @41 varchar(10); SELECT @S1 = (SELECT TOP 1 [cExt] FROM [eazybusiness].[dbo].[ameise_importvorlagefeld] Where kImportVorlage = @Importvorlage and cDBName LIKE '%fVKNetto%' Order by cDBName), @Split1 = ';', @Split21 = '#', @Split31 = ','; Select @y1 = Replace(@S1,@Split21,'</s><s>'); Select @y1 = Replace(@y1,@Split31,'.'); SELECT @X1 = CONVERT(xml,'<root><s>' + REPLACE(@y1,@Split1,'</s><s>') + '</s></root>') DECLARE calc1 SCROLL Cursor FOR SELECT [Value] = T.c.value('.','char(20)') FROM @X1.nodes('/root/s') T(c) -- Row 48 OPEN calc1; FETCH NEXT FROM calc1; WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM calc1; FETCH PRIOR FROM calc1 INTO @11 FETCH NEXT FROM calc1 INTO @21 FETCH NEXT FROM calc1 INTO @31 FETCH NEXT FROM calc1 INTO @41 FETCH PRIOR FROM calc1; if @41 = '' BEGIN SET @41 = '100000000'; END; Insert into #param1 (minvalue, maxvalue, operator,multiplicator) Values (@11, @41, @21, @31); if @41 = '100000000' BEGIN BREAK END FETCH NEXT FROM calc1; END CLOSE calc1; DEALLOCATE calc1; --SELECT * FROM #param1; .... more code
I have marked the row 48 with a comment
Code explanation:
the code is splitting a string (multidim array) variable1#variable2#variable3#;variable1#variable2#variable3#
into a temp table
Can anyone please take a look at my problem and give me a push into the right direction?
Would be very nice, many thanks in advance
kind regards
exxon