Skip to content
Advertisement

Tag: sql

C# INSERT to SQL method exception when DateTime parameter is null

One of my parameter looks like this: I know that User has null value in last_sign_in_at. Database accept nulls for this column but I get an exception: SqlException: The parameterized query ‘(@id int,@name nvarchar(18),@username nvarchar(11),@state nvarch’ expects the parameter ‘@last_sign_in_at’, which was not supplied. Answer You should be using DBNull.Value: Casting to object here is just for operator ?? to

SQL select single row number x only

For processing SQL data in VBA I want to use a loop (For…Next) that reads line by line from a SQL database. As records were deleted the ID column has gaps. The table looks for example like this: Having four lines I would like to run of course a “For each” would do good, too. Answer If you want 4

Mysql comma seperated to json-array

I have some fields in the database that are comma selerated, something like: a,b,c,d,e and I want to convert them into: I know how to do it in nodejs / any other language, but I need to do it directly on the mysql Possible? Thanks Answer The simplest approach probably is to use string functions only: Basically this turns a

Oracle Procedure call too long string

Hello I have one procedure like my problem is that P_SICIL or P_EXISTS can be too long so all length can be more then 4000 characters. when I call procedure it gives below error ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 14103, maximum: 4000) if I dont use to_char for clobs then I

T-SQL: removing Time and Preceding characters from nvarchar column

I have a comments column in a SQL Server database table of type nvarchar and typically contains text along the lines of: I am trying to find a way in the select statement to remove the character pattern of ‘#:#:# AM/PM’ and everything preceding it leaving me with “Blah Blah…” In doing so I don’t want to remove legitimate uses

SQL query to get data without hours in timestamp column

I have written a code and sql query to get data from database: I get this dataframe: I want to write another query to get data only for 2019-05-29: but it brings me an error: How could i do that? How could i get rid of hours in timestamp column in my sql query? Desired result is: Answer toDate(timestamp) SELECT

Advertisement