Table: Dates (nvarchar) == 23/02/2009 (dd/mm/yyyy) 24/02/2009 25/08/2009 28/12/2011 …. I want to change the date form like this (yyyymmdd) Tried query select cast(dates as datetime) from table1 Showing error ЮArithemetic expression overflow select Convert(char(10), dates, 112) from table1 Showing the same value 23/02/2009 The above query is not working. Expected Output 20090232 20090224 20090825 […]
select * from table_name where BaseDocEntry=15 and BaseDocType=’PRRH’ and ItemCode=’TestStudy2′ and WhseCode=’01’ and (currentdoctype<>’PUSH’ and CurrentDocEntry<>15) According to the query I have written above, the data from INS2 will be fetched excluding the currentdoctype [PUSH] and all data where CurrentDocEntry is not 15. What I expect my query to be is, it must exclude the […]
I am trying to pass parameters to my stored procedure. They are like this @p_latitude=”,@p_longitude=”,@p_miles=”,@p_searchtext=”,@p_maptownid=182,@p_regionid=0 From code I am passing the parameters like cmd.Parameters.Add(“@p_latitude”, SqlDbType.NVarChar).Value=”””; cmd.Parameters.Add(“@p_longitude”, SqlDbType.NVarChar).Value=”””; cmd.Parameters.AddWithValue(“@p_miles”,0); cmd.Parameters.Add(“@p_searchtext”,SqlDbType.NVarChar).Value=”””; cmd.Parameters.AddWithValue(“@p_maptownid”,maptownid); cmd.Parameters.AddWithValue(“@p_regionid”,0); I’m getting an error cannot convert navarchar to float. I tried in different ways sending null, string.empty. But couln’t find it.
In C#, how do I manually build a proper connection string? I have the server name, database name, user name, and password. This is a SQL Server database and .NET 4.0. I looked at the SQLConnectionStringBuilder and that appears to be what I want but I don’t know how to specify the server.
Does anyone know why the results of the following 2 queries do not add up to the results of the 3rd one? SELECT COUNT(leadID) FROM leads WHERE makeID NOT IN (SELECT uploadDataMapID FROM DG_App.dbo.uploadData WHERE uploadID = 3 AND uploadRowID = 1) AND modelID NOT IN (SELECT uploadDataMapID FROM DG_App.dbo.uploadData WHERE uploadID = 3 AND […]
I was not sure how to title this issue, below is an example of what I want to do which is create two values of a total of something above a threshold and one for below but the two statements are exclusive of one another. I thought using a left join or left out join […]
I have to deal with a mssql database and the information given in a table like this: Users: ID Name Countries ——————– 1 User1 1,2,3 2 User2 2,5 Countries: ID Country ———- 1 Australia 2 Germany 3 USA 4 Norway 5 Canada Now, what i am looking for is a select statement that will give […]
I am trying to insert around 200M records into a table after doing a select from a fact table but a System.OutOfMemoryException Following is my query : Select ProductID, SaleDate, Quantity from dbo.Product where SaleDate BETWEEN ‘2012-01-01’ AND ‘2016-01-01’; The result of the above SELECT returns 200M records which is to be inserted in a […]
I have a problem to introduce a good versioning in my database design. Let’s make a easy example. A little rental service. You have a table Person (P_ID, Name), table Computer (C_ID, Type) and a table Rent (R_ID, P_ID, C_ID, FromData, ToData). I want to be able to change say the user name, create a […]
I have two table emptable1(empid,status) emptable2(empid,week) i want to select all the empid whose status is 0 in emptable1 and from that list of empid i need to select empid whose week is 7 from the table emptable2 Please help 🙂