473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Conversion failed when converting from a character string to uniqueidentifier

Hi,
i have a field createdby with datatype GUID.
In following query ,i encountered with the error
"Conversion failed when converting from a character string to uniqueidentifier"

select
ISNULL(VW_tbl_ChildProducts.createdBy,' ' ) as createdBy
from table.


it is running with sql server 2005, but not supporting by sql 2000.
what is the synax in 2000?
Apr 19 '08 #1
2 11155
siva538
44
Hi,
i have a field createdby with datatype GUID.
In following query ,i encountered with the error
"Conversion failed when converting from a character string to uniqueidentifier"

select
ISNULL(VW_tbl_ChildProducts.createdBy,' ' ) as createdBy
from table.


it is running with sql server 2005, but not supporting by sql 2000.
what is the synax in 2000?

Empty string cannot be used for ISNULL place holder, instead 0x00 should be used for the same

Expand|Select|Wrap|Line Numbers
  1. select
  2. ISNULL(VW_tbl_ChildProducts.createdBy,0x00 ) as createdBy
  3. from table.
  4.  
Apr 19 '08 #2
ck9663
2,878 Expert 2GB
Hi,
i have a field createdby with datatype GUID.
In following query ,i encountered with the error
"Conversion failed when converting from a character string to uniqueidentifier"

select
ISNULL(VW_tbl_ChildProducts.createdBy,' ' ) as createdBy
from table.


it is running with sql server 2005, but not supporting by sql 2000.
what is the synax in 2000?

An empty may be placed as placeholder for ISNULL.

As in

Expand|Select|Wrap|Line Numbers
  1. declare @x as varchar(5)
  2.  
  3. select isnull(@x,' ')
When using ISNULL, you have to make sure that the value that will be used in replacement of the field being checked may be used to replace the field being checked. So if the field is datetime, the replacement value should also be datetime or at least may be converted into datetime.

It looks like you're checking a column that is a uniqueidentifier data type but you're replacing it with a string/varchar.

Read more about uniqueidentier here

-- CK
Apr 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable...
5
by: Karthik | last post by:
Hello! I am not a wizard in this area! Just need some help out in this. I am trying to convert bstr string to new character string. Here is the snippet of my code. **** Code Start**** ...
1
by: mdawoodk | last post by:
i am getting error "input string was not in correct format" when converting a string decimal into integer value. code is like this: string strVal = ""; int nVal = 0; strVal = "14.9"; nVal...
8
by: Brand Bogard | last post by:
Does the C standard include a library function to convert an 8 bit character string to a 16 bit character string?
3
by: blazeboy | last post by:
Hello, I am using a SQL data source to insert records into a table. The table uses a GUID as the primary key (GoalEventID), and a GUID for a second field (GoalID) as a foreign key. When I call...
9
by: gggram2000 | last post by:
I need some help, cant figure out the error. SqlConnection dbConnection = new SqlConnection(xmldb); dbConnection.Open(); string sql = "SELECT InvStatus FROM SaleReceipts Where AccNum = '" +...
5
by: Joell | last post by:
When I try to insert values into an existing table, I am getting the following error. The table is not in bit data type format and neither is the target table. Conversion failed when converting the...
1
by: vertigo262 | last post by:
This is driving me crazy I run this query in the sql management studio and it works fine. but seems like it doesn't work in the stored procedure Can I not use a LIKE '%' in an integer field? ...
0
by: dougancil | last post by:
I have the following code: Imports System.Data.SqlClient Public Class Main Protected WithEvents DataGridView1 As DataGridView Dim instForm2 As New Exceptions Private Sub...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.