.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Error comparing two identical columns in Condtional Split

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Sql Server

(SQL 2005)

I'm reading in one SQL table and doing a lookup against another SQL table which is an identical copy of the first table, used for temporary storage during the load event.

I want to compare each field to find if there are any changes in the temporary table.  When I compare two string fields, Customer != temp_Customer I get no error message.  When I compare two decimal fields, Width != temp_Width I get an error message: DT_WST and DT_Numeric are incompatible with !=.

The two fields are BOTH declared as decimal 19,6 in their respective tables.  Why can't I run this comparision???

View Complete Post

More Related Resource Links

Calculated Columns in a Form Library receive error: Value does not fall within the expected range.


I have a forms library that posts the date the form was created. We would like to create a calculated column that allows us to look at these forms based on the month and year they were created. I had created a calculated column that extracts the month and replaces the number with a text string by using an if statement; "IF(MONTH([Proposal Date])=1,"January","") It goes on to evaluate each month and replace the number with the text string. This formula worked for quite some time, though now when I try to add any calculated columns or edit any existing calculated columns on this form library I receive the following error: Value does not fall within the expected range. Now my existing calculated columns (like the one above) do not work and I can not create new calcualted columns. Any insight would be awesome as this has been plaguing me for a couple of months now.

split a column into multiple columns

Hi i have a column with the following values from my source FILENAME ComplianceStatus_ER_06022010.xml ComplianceStatus_AZER_07052010.xml ComplianceStatus_GEL_06022010.xml ComplianceStatus_AFF_05022010.xml ComplianceStatus_Good_2010.xml   I want to split the date into different columns as follows using ssis   FILENAME                            CLIENT      DATE ComplianceStatus_ER_06022010.xml    ER          06022010 ComplianceStatus_AZER_07052010.xml  AZER        07052010 ComplianceStatus_GEL_06022010.xml   GEL         06022010 ComplianceStatus_AFF_05022010.xml   AFF         05022010 ComplianceStatus_Good_2010.xml      Good        2010  

Error when creating PK to a column which has dupliacte columns..

The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'table name' and the index name 'PK__column__118068EB'. The duplicate key value is (D1).

Insert columns into GridView and rendercontrol error

Hi I´m inserting columns into a gridview at run time using: gvRageReport.Columns.Insert(index, column) When I render the gridview in orther to export to excel all the excel columns are empty except the new insert columns, but when I add the new columns using gvRageReport.Columns.Add(column) the excell is exported successfully.Any idea?

Duplicate columns names not allowed - OPENQUERY - OPENROWSET - Error 492

I have a piece of code below which manipulates incoming XML. I understand why it is failing in SQL2005, due to the duplicate name "Process". What i dont understand is why this works fine in SQL2000? We are trying to migrate from SQL2000 to SQL2005 and even if we run SQL2005 in 8.0 compatibility mode we still get the error. Why does it work in SQL2000 and is there anyway to emulate this behaviour in SQL2005? I really do not want to work through +-600 SPs to see if I need to change anything. Thank You declare @Event varchar(255) declare @XML varchar(3000) set @event = '' set @xml = '<OmegaEvent Process="NEWBUSINESS" Type="APPFORM" DateTimeStamp="2010-09-02T06:06:43" Version="3.0"> <APPFORM> <BUSSUNIT>AN</BUSSUNIT> <CATEGORYDESC> </CATEGORYDESC> <CHECKDIGIT>B</CHECKDIGIT> <CLIENTSTATUS> </CLIENTSTATUS> <CONVERSION> </CONVERSION> <DISTRCHANNEL> </DISTRCHANNEL> <EVENTDATE>20100902</EVENTDATE> <EVENTTIME>60643528960</EVENTTIME> <FINALISOR>N</FINALISOR> <FORM>MIFU</FORM> <FORMNAME>MAX INCOME COMPULSORY</FORMNAME> <INTERMEDCODE> </INTERMEDCODE> <MAIL_CAMPAIGN> </MAIL_CAMPAIGN> <POLICYNO>016058558</POLICYNO> <PROCESS>ICC</PROCESS> <PR

Comparing columns with NULL values--Merge says unmatched when data is matched.

I found the article below describing this same issue with the Oracle merge statement.  It also described a work-around:    http://searchoracle.techtarget.com/tip/Merging-datasets-with-NULL-values I have been unable to find a solution to this issue for SQL Server 2008.  I am trying to do basic ETL from Staging table to a Type II dimension table in a Data Warehouse.  I am using the Merge statement with the Unique key minus the modification date as my merge key list.  I have a handful of columns (in both Staging and the DW) containing nulls in my merge key list.  I have tried the ISNULL function and the ANSI_NULL db option (OFF) with no success.  When I put zeros in the null columns, it works as expected.  I am about to try separate INSERT and UPDATE statements, but I fear that the NULL comparison issue will bite me there with the JOIN statement.  Has anyone else experienced this?  NULL values are valid in our Data Warehouse.  How can I make T-SQL handle them? Thank you for your help, Jesse

OPENQUERY Error when calling usp - object has no columns or the current user does not have permissio

Hi Guys, I need to get data using a usp, but getting error: Cannot process the object "EXEC BKS..uspPayments @paymentTypeCode1 = '1', @paymentTypeCode2 = '2', @paymentTypeCode3 = '3';". The OLE DB provider "SQLNCLI" for linked server "SERVER" indicates that either the object has no columns or the current user does not have permissions on that object. I am trying the script below: use myDB; select * from OPENQUERY([SERVER], 'EXEC myDB..uspPayments @paymentTypeCode1 = ''1'', @paymentTypeCode2 = ''2'', @paymentTypeCode3 = ''3''; ') Thanks in advance for any help. Everything is possible, impossible just takes longer

GridView split over multiple columns



I have a project where I need the one datagrid displaying all values on the one screen, thus I don't have paging enabled.

Is there a way to get a gridview to 'split' over two columns?

ie instead of having

|<- column 1 ->|<- column 2 ->|<-button->|

item 1


Item 30


|<- column 1 ->|<- column 2 ->|<-button->|<- column 1 ->|<- column 2 ->|<-button->|

Item 1                                                            Item 16


Item 15                                                          Item 30

How to Get a Final Value based on comparing two columns for set of columns


Hello All,

Please help me here, to solve this query,  i included in detail, what i trying to achieve for


-- Create Table DDL
CREATE TABLE [dbo].[TestTable2](

[varchar](5) NOT NULL,
 [midvendor] [varchar](5) NOT NULL,
 [odate] [varchar](6) NOT NULL,
 [orderid] [varchar](10) NULL,
 [marketid] [varchar](5) NOT NULL,
 [Amount] [float] NULL,
 [MagicAmount] [float] NULL,
 [Units] [int] NULL,
 [MagicUnits] [int] NULL,
 [Final] [varchar](10) NULL,
 [Reason] [varchar](30) NULL


---- Data Insert DDL

insert into testtable2 values ('BAY1','MAD','DEC21',NULL,'1070',0,48526,NULL,8,NULL,NULL)
insert into testtable2 values ('BAY1','MAD','DEC21','161711','1070',70965,0,9,NULL,NULL,NULL)
insert into testtable2 values ('BAY1','MKA','DEC21',NULL,'1070',0,372419,NULL,43,NULL,NULL)
insert into testtable2 values ('BAY1','MKA','DEC21','161891','1070',389392,0,49,NULL,NULL,NULL)
insert into testtable2 values ('BAY1','MLD','DEC21','162102','1070',0,0,0,NULL,NULL,NULL)
insert into testtable2 values ('BAY1','MLD','DEC21

split separated values into columns


Hi @all,

here is my current data structure...


item1   item2

1;2;3   4;5;6


I need to transform the structure to that one. How can i do that?

item1          item2

1                  4

2                  5

3                  6

How to Get a Final Value based on comparing three columns for set of columns


Hello Sir,


in continuous to this below is a new math, i am trying to solve but very hard to get it done, could some please help me.....

--- Original Draft
-- Create Table DDL
CREATE TABLE [dbo].[TestTable2](

[varchar](5) NOT NULL,
 [midvendor] [varchar](5) NOT NULL,
 [odate] [varchar](6) NOT NULL,
 [orderid] [varchar](10) NULL,
 [marketid] [varchar](5) NOT NULL,
 [Amount] [float] NULL,
 [MagicAmount] [float] NULL,
 [Units] [int] NULL,
 [MagicUnits] [int] NULL,
 [Final] [varchar](10) NULL,
 [Reason] [varchar](30) NULL,
 [CheckCol1]  [varchar](10) NULL,
 [CheckCol2]  [varchar](10) NULL,
 [CheckCol3]  [varchar](10) NULL


---- Data Insert DDL

insert into testtable2 values ('BAY1','MAD','DEC21',NULL,'1070',0,48526,NULL,8,NULL,NULL,'0','0','0')
insert into testtable2 values ('BAY1','MAD','DEC21'

comparing two database tables to all find matching columns



is there any query to find matching columns from two database tables(not system tables).




Thanks and regards, Rishabh

How to split columns in gridview?


Hi there,

I am using Visual Studio 2010 where I have a gridview that displays many columns and because of that the user has to scroll horizontally in order to view the rest of the columns.

Is there a way to split the columns so that each row will contain some columns and some columns underneath them?

For example, I have 10 columns where each row will show 5 columns with their headers and the other 5 columns below with their headers.

Your help will be greatly appreciated.

Split Address into 3 columns using a udf


Hi All,


I have a column which consists of data as City,state Zip. They are combined in this way together. EX:



How to split this into 3 separate columns using a function so that i can use this function in a view .




Split comma separated values into columns




 I have data like this in my table:


AppId   Gender

1         x

2         y

3         x, y

4         x, y, z


I need to transform like this:

AppID          Gender

1                  x

2                  y

3                  x

3                  y

4                  x

4                  y

4                  z


How to do this?


Thanks in advance

display / insert values by comparing 2 columns of a table



i have a table which has the following columns 

A_ID, A_Value,A_Date,B_ID,B_Value_B_Date


i have another table as follows

A_ID,B_ID,A_Value,B_Value, Date


this is to be done 

* if A_date and B date are equal, one record shoould be entered to the TABLE 02. the values should be A_ID,B_ID,A_Value_B_Value and A_Date (since the date is equal, no problem; even can insert B_Date instead of A_Date)

* if A_Date and B_Date are different, then the following should happen

insert one record to TABLE02 as A_ID,B_ID, A_Value, 0 , A_Date

insert another record to TABLE02 as A_ID,B_ID, 0 , B_Value, B_Date


(As you can see, when the date differs we enter the single record of Table 01 into 2 recoerds in table 02. the Value column and Date column are related in such a way that when A's date is entered, the value for B should be 0 and vise versa..)


i tried having a UDF but in halfway remembered that we cannot include INSERTS in UDFs..

can anyone please explain me how can i solve this problem ??


PS: For your reference , i've sketched a diagram. please click on this link to view it for further clarifications



thanks in advance

-novicedba :)

Conditional Split Error


Hi Guys,

Source Files - String Datatype



H, 1, 353474, 06, 52, 01, 01, 2009

C, 4

I, MV6106, 1, 3.85, , 3.85, R,  , 

T, 65496, -0.35

T, 1, 20.00

H, 1, 353475, 06, 53, 01, 01, 2009

C, 4

Reference: Cashout_TX_353476

I, 30159, 1, 1.00, , 1.00, R,  , 

I, 458287, 1, 6.91, , 6.91, R,  , 

I, 394085, 1, 2.15, , 2.15, R,  , 

I, MV1293, 1, 2.80, , 2.80, R,  , 

I, 132700, 1, 6.54, , 6.54, R,  , 

T, 65496, -0.88

T, 8, 19.40

H, 1, 353476, 06, 53,

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend