As title says I’ve used odbcconnection to sqlconnection and for the life of me cant get it to work.. Copied a bunch of code from this site but cant get them both to work. The program just hangs so …
Tag: sql
Remove Duplicate Time Zones From SELECT query
I need help removing duplicate time zone records from my select query without deleting them. The current result is as follows: The table returns duplicate GMT start times for the same employee, the database appears to be duplicating the results based on different time zones. I just want to remove the duplicat…
C# BulkCopy.WriteToServer Changing Values
I have a datatable that is created from and excel sheet. I am trying to SqlBulkCopy.WriteToServer. When I do so it converts my “Percent” value to 0 when my tables schema has type Decimal(38,0) for the “Percent” column. However, it inserts correctly when I have the Data Type as Float. I…
Group by using linked tables
I have linked tables. Calls and Call Lines, both tables have a seperate ‘Call Type’ field, I am trying to get the number of calls and the number of call lines which were added on a certain date and then see the split for the types. The below query returns the number for each Call Line which was ad…
In SQL, how do I prevent array elements from being null?
I’m designing a SQL database and I’d like to make sure my schema is as strict as possible. Is there a way to require that an array column doesn’t contain null elements? As I understand it, I can make the whole column NOT NULL, but that’s not the same thing since an array of null elemen…
Need to identify overlapping dates
I need to find overlapping dates for a table. So the basic structure is ID, PFX, Start date, and end date. So where the PFX for a given ID is overlapping with another PFX for each ID. I tried this and had no luck. https://www.sqlservercentral.com/forums/topic/how-to-extract-overlapping-date-ranges-from-a-tabl…
Use Regex to Exclude any values that do not have a letter
For example, column below: My desired output would be: I tried this but no luck: UPDATED EDIT: Data Type = VARCHAR(16777216) Answer on snowflake this works: gives: And given REGEXP is an alias for RLIKE this also works given these behave like LIKE which is a non-greedy match, the wildcards are needed to match…
Select statement inside for loop
I’m trying to put my select statement inside a for loop and after looping I want to insert the result on a table but upon my execution I bump in to this error. ORA-06550: line 5, column 7: PLS-…
How to pass a Variable/Function into SQL Query?
I am attempting to Insert a Row on a Table, but I cannot seem to pass the TASK_ID as a value/variable/function into the SQL Statement. Throughout the application, to acquire TASK_ID, I use: Dim …
how to fetch top 9 and others based on count(entity_id) sorted highest top 9 and then club the other count into ‘others’ category
The following query executes everything: SELECT count(entity_id), cim.institute_id, cfi.name_ FROM ci_certification_students cis INNER JOIN ci_certification_master cim ON cis.certificate_id = cim….