SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error converting data type varchar to bigint.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

peace
Constraint Violating Yak Guru

414 Posts

Posted - 10/18/2013 :  05:09:32  Show Profile  Reply with Quote
i have this data:

BookedID Booked_Date
114199636 2013-01-09 14:55:21.740

would like to get the output into txt format with delimited in between columns.

i tried this but getting this error: Error converting data type varchar to bigint.

select BookedID+'|'+Booked_Date from tableA

bandi
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 10/18/2013 :  05:16:20  Show Profile  Reply with Quote
select CAST( BookedID AS VARCHAR(20))+'|'+Booked_Date from tableA

--
Chandu
Go to Top of Page

peace
Constraint Violating Yak Guru

414 Posts

Posted - 10/18/2013 :  05:21:20  Show Profile  Reply with Quote
still getting the error
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 10/18/2013 :  05:35:52  Show Profile  Reply with Quote
what are the datatypes og BookedID and Booked_Date

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 10/18/2013 :  08:02:34  Show Profile  Reply with Quote
would like to get the output into txt format with delimited in between columns.
for that you can use export import wizard or bcp with format file

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22769 Posts

Posted - 10/19/2013 :  10:18:30  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by bandi

select CAST( BookedID AS VARCHAR(20))+'|'+Booked_Date from tableA

--
Chandu


You need to convert booked_date into varchar too. But Visakh's suggestion is the way to go

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000