I have a SQL server table where I want to query for items on rows which have a value equal to an item in Array. Here’s my example: And my array: So, I want to return from SQL rows matching items in the array. my SQL query should return items where column1 matches an item in the array: This all
Tag: sql-server
concatenate tinyint datatypes column using derived column in ssis
I have asked a similar Question before but this time I have problems with single-byte unsigned integer What I am trying to achieve is Column 5: Columns 1, Column 2, Column 3 and Column 4 data types is Tinyint but for Column 5 I need it as a string preferably varchar 100. So I tried: But I can’t seem to
How to compare records in a SQL Table
I have a table name TransactionTable. If InsuranceCode = ‘ADAP’ and IsADAP = 1, I have to filter these records and return the remaining records. I am trying to write something similar to this syntax. Total records in TransactionTable is 1832 and Total records on filtration criteria is 109. I expec…
How to convert a varchar column to bit column in SQL SERVER
Flag1 is a varchar column with values “true” and “false”. I need to convert this into bit column. When I try to do this: Convert(Bit,Flag1) it shows an error Msg 245, Level 16, State 1, Line 2 …
SQL SERVER Insert Addition?
So this seems like something that should be easy. But say I had an insert: and I wanted X to go from 1-100. (Knowing there are some of those numbers that already exist, so if the insert fails I want it to keep going) how would I do such a thing? Answer Here’s a slightly faster way
XML to SQL – Selecting multiple nodes with the same name
I have working code that can select a few values from an XML file. The problem is that I have multiple nodes with the same name. Here is a snippet of the XML:
SQL select from inner join where count greater than
Doctor doctorid (PK) doctorname Patient patientid (PK) patientname doctorid I have the following query to get the doctors details with the number of patients that he/she consults. assume a patient has only one doctor to consult. Now I need to get the same information but only for the doctors who has more than…
How to delete a stored procedure?
Using this we can create procedure then how to delete,alter…etc,Can any one help me how to delete procedure. Answer Try this USE [PSI Data] DROP PROCEDURE [dbo].[savepsi]; GO
SQL Server : round and add percent sign
I have the following SQL query that is returning a result of 92.967013425802 and I need it to be formatted like 93% and add the percent sign. I have tried changing the sum to round but I received an …
How to read sql query from a txt-file in Java
I am having some some class that is sending queries to data base. Everything was working fine when the query was in the code, but as it’s pretty big, I decided to put it in a file and to read it with buffered reader, but it’s not working, I always get this: java.sql.SQLException: ORA-00900: invali…