Conversion failed when converting the varchar value to datatype int in SQL Server

I am getting an error Conversion failed when converting the varchar value ‘ORB2.0000000001’ to data type int. Can you please help me resolve this issue? The stored procedure is working fine in development but on another machine I am getting that error ALTER PROCEDURE [dbo].[EMR_GetReportData]( @FromDate DATETIME , @ToDate DATETIME , @Code varchar(20) = NULL […]

How to get combination of Measure count using same dimension

how can i get all the combination of Dimensions Measure count in MDX. In the Below image I’m getting individual value measure count but how can i get combination of values measure count.Say for example i have got the individual value count for 262,210 and 198 DrKey Dimension.I would need value count combination like 1) […]

SQL Using row data from one table to choose data from a specific column in a different table

I have one table with row data that matches column names in a different table as such: Items: ProdName ProdNum Quality Type Price Teddy Bear 123 Low Toy 5 Airplane 234 High Toy 20 Monopoly 345 Mid Game 15 Chess 456 High Game 20 Tax Bracket: Type Low Mid High Toy .05 .07 .1 Game […]

Calculate date between two date and sum then convert into hours and minutes

I want to get the Date difference in hours and minutes and to achieve that I have used this query in SQL Server: Cast(SUM(DATEDIFF(second, fromtime, totime) / 60 / 60 % 24) as varchar(20)) + ‘ hours ‘ +CAST(SUM(DATEDIFF(second, fromtime, totime) / 60 % 60)as varchar(20))+’ minutes ‘ as [TotalTime] It returns the following Output: […]

how to use where condition in sql query after data encrypted

Is that possible to use where condition in sql after converting data in to encrypted?

Opening rowset for “September$” failed. Check that the object exists in the database

I’m getting the following error when trying to import an Excel file into my database. I have tried both importing the data into an existing table, and also letting the Import Wizard create a new table. When checking the mappings, everything looks good. Any insight into this error would be greatly appreciated. Here is a […]

How to perform calculation for multiple rows in sql

I have 4 result sets which i moved into one temp table for report purpose: Date Issued_Id Item_Name Qty_Issued Qty_Return Qty_Damage Type Balance OPBal ———————————————————————————————- Dec 18 2014 6003 Bed Covers 4 0 0 IS NULL 245 Dec 18 2014 6008 Bed Covers 4 0 0 IS NULL 245 2014-12-17 6000 Bed Covers 0 22 […]

Get Scope identity for multiple inserts

For table1 Inserted 3 records It should get those three identities and it should insert 3 records in table3 (but it’s not happening- it inserts 3 records with same identity ie.last scope identity) create table table1(ID INT identity(1,1),Name varchar(50)) insert into table1 values(‘Ram’),(‘Sitha’),(‘Laxman’) create table table1(ID INT identity(1,1),Name varchar(50)) create table table3(ID INT ,Name varchar(50)) […]

select from table sql ce server between date returning 0

I am developing a windows form application in C#. I have a query where i want to select from date to date. the result is always 0. My DB is a .sdf file, and in my table I have a datetime field to store the order date as DateTime.Now, and my PC dateformat is 10.12.2014, […]

Understanding how a Primary Key of one Table can be a Foreign Key too

I’ve been given the code below: — Create Customers table CREATE TABLE Customers ( cust_id char(10) NOT NULL , cust_name char(50) NOT NULL , cust_address char(50) NULL , cust_city char(50) NULL , cust_state char(5) NULL , cust_zip char(10) NULL , cust_country char(50) NULL , cust_contact char(50) NULL , cust_email char(255) NULL ); — Create OrderItems […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.