Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving issues with UPDATE command
    text
    copied!<p>Using this SP I keep getting an error on the UPDATE statement indicating that I have conversion problem or something. But ID is an integer in all of my tables....</p> <p>Conversion failed when converting the varchar value 'UPDATE tblLangenUS SET [lang_String] = ' - asdfgsdfg', [prev_LangString] = ' ', [needsTranslation] = 'false' WHERE [ID] = '' to data type int. </p> <pre><code> @currTable varchar(100), @ID int, @short_Text varchar(250), @brief_Descrip varchar(250) = Null, @needsTranslation varchar(10) = Null, @prev_LangString varchar(250) = Null, @lang_String varchar(250) = Null, @original_lang_String varchar(250) = Null, @StringID_from_Master varchar(250), @GUID varchar(250) = Null /* </code></pre> <p>*/</p> <pre><code>AS SET NOCOUNT ON; DECLARE @userTable AS VARCHAR(200); SET @userTable = @currTable DECLARE @submitDate1 DATETIME; SET @submitDate1 = GETDATE() SET @prev_LangString = @original_lang_String SET @needsTranslation = 'false' DECLARE @sql varchar(max) -- Establish update to the language tabel of user and prepare to search DB for all strings that will need to be updated. BEGIN SET @sql = 'UPDATE ' + @currTable + ' SET [lang_String] = ''' + @lang_String + ''', [prev_LangString] = ''' + @prev_LangString + ''', [needsTranslation] = ''' + @needsTranslation + ''' WHERE [ID] = ''' + @ID + '''; ' EXEC @sql @sql = '' END BEGIN DECLARE usedIN_DBScursor CURSOR FOR SELECT tblUniquetblStringsMaster_ID, Database_Name, dbKeyID_ofStringName FROM tblDBUsage WHERE (tblUniquetblStringsMaster_ID = @StringID_from_Master ); -- Declare the variables to store the values returned by FETCH. DECLARE @tblUniquetblStringsMaster_ID AS INT; DECLARE @dbKEYID as INT; DECLARE @dbName as varchar(100); OPEN usedIN_DBScursor; -- Perform the first fetch and store the values in variables. -- Note: The variables are in the same order as the columns -- in the SELECT statement. FETCH NEXT FROM usedIN_DBScursor INTO @tblUniquetblStringsMaster_ID, @dbName, @dbKEYID; -- Check @@FETCH_STATUS to see if there are any more rows to fetch. WHILE @@FETCH_STATUS = 0 BEGIN -- Update pending strings table with translation. BEGIN INSERT INTO tblPendingDBUpdates (stringMasterID, databaseName, databaseStringID, englishText, foreignLangText, submitDate, GUID) VALUES (@StringID_from_Master, @dbName, @dbKEYID, @short_Text, @lang_String, @submitDate1, @GUID); END -- SET @sql = '' -- This is executed as long as the previous fetch succeeds. FETCH NEXT FROM usedIN_DBScursor INTO @tblUniquetblStringsMaster_ID, @dbName, @dbKEYID; END CLOSE usedIN_DBScursor; DEALLOCATE usedIN_DBScursor; END RETURN </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload