I got a table with zero values ββin it. I would like to copy this table to another and replace the null value from one column, for example 0. Is it possible that my target table does not accept null values ββin this column
Insert into MyNewTable (A, B, C) select (AA, BB, CC) from MyOldTable
And CC may be null
thanks for any help
Just use ISNULL()
ISNULL()
Insert into MyNewTable (A, B, C) select (AA, BB, ISNULL(CC,0)) from MyOldTable
IsNull(a, b) Coalesce(a, b, c, ...), IsNull "b", "a" null, Coalesce . , IsNull() ( ) "b" "a" , Coalesce , .
IsNull(a, b)
Coalesce(a, b, c, ...)
.. "a" int, IsNull(a, '1') , IsNull(a, 'hello') , Coalesce(a, 'hello') , , a null, , , ('hello') int, auotmatic a ( null) varchar.
int
IsNull(a, '1')
IsNull(a, 'hello')
Coalesce(a, 'hello')
a
You can use the function coalescefor this:
coalesce
INSERT INTO MyNewTable (A, B, C) SELECT COALESCE(AA, 0), COALESCE(BB, 0), COALESCE(CC, 0) FROM MyOldTable
Source: https://habr.com/ru/post/1791474/More articles:Simple Javascript loop - javascriptCSS Gradients with a little content - cssHow to parse and debug gdb core without characters using registers and source stack - stackparse_url () when one of the parameters is url - urlMocha :: Integration of an uninitialized constant - ruby-on-railsList of nested maps Erlang - listCreate a springboard as the main view - springboardhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1791477/how-to-use-jquery-to-log-values-to-firebug-console&usg=ALkJrhhDrUuov5U_QYMqxqLhNVgHdSOSjACreate xcodeproj - xcodeEmacs find-grep-dired, then automatically isearch-forward with the given regular expression - grepAll Articles