Last two column are same. but i need to select my query based on two values select * from my table where ID='12345' and IPAddress='184.108.40.206'; how can i modify above query to get as i needed. pls help me
Something about what you are saying doesn't seem consistent. If the IPAddress field is VARCHAR(15), then the query I posted earlier should have shown different values for ColumnValue and ExpectedValue. But you were getting the same value.
Can you run the following queryies and post the results?
SELECT DATA_TYPE FROM INFORMATION_SCHEMA.[COLUMNS]
WHERE TABLE_NAME = 'mytable' AND COLUMN_NAME='IPAddress';
CAST(IPAddress AS VARBINARY) AS ColumnValue,
CAST(N'10.23.40.5' AS VARBINARY) ExpectedValue
FROM mytable whereID = '12345';
I am really grasping at straws because I don't think varchar vs nvarchar should make any difference in this case. There is something very simple and very obvious that we are missing - but it is so obvious that I can't figure out what it might be!