Solved

Select and convert to string

Posted on 2013-11-12
2
352 Views
Last Modified: 2013-11-12
I am using a dreamweaver extension to export data to excel but it has a bug and gives an error upon a large number.
Workaround is to select the fields for the recordset and convert them into 'string' so that the error is avoided, they said I should add "number" (quotes) before and after the number.

How can I do this ?  this is my select statement:

--

SELECT a.UserId, a.UserType, a.FirmId, a.EmployerId, a.LastNm, a.FirstNm, a.DobD, a.SSN, a.Email, a.Nationality, a.NiStatus, a.ExpiresOnD, a.Docstatusstat, a.NIVMaxStatus, a.I94DateD, a.I94, a.I797Date, a.I797, a.EadDate, a.Ead, a.ApDate, a.ApNum, a.Iap66Date, a.Iap66, a.GcDate, a.GC, a.I20Date, a.I20, a.PpExpireOnD, a.PpNum, a.PobCountry, b.MaidenNm as Employer, d.MailStr + ' ' + d.MaidenNm as Attorney, a.PobCountry, a.archivedcont, a.contactstatus, a.Docstatusstat, e.Docstatdesc,a.Dswg, a.VisaExp, a.VisaType, a.VisaStatus
FROM users a Left join users as b on a.employerid = b.userid Inner join attscont as c on a.userid = c.userid Inner join users as d on c.attyid = d.userid left join Documentstatus as e on e.documentstatus = a.Docstatusstat
WHERE a.usertype = 'contact' and a.firmid = MMColParam AND d.userid = MMColParam2 AND a.Archivedcont LIKE 'MMColParam3' and a.Contactstatus LIKE 'MMColParam4' AND ISNULL (a.FirstNm,'') LIKE 'MMColParam5%' and ISNULL (a.LastNm,'') LIKE 'MMColParam6%' and ISNULL (a.SSN,'') LIKE 'MMColParam7%' and ISNULL (a.email,'') LIKE 'MMColParam8%' and ISNULL (a.Nationality,'') LIKE 'MMColParam9%' AND ISNULL (a.Nistatus,'') LIKE 'MMColParam10%'
ORDER BY MMColParam500

--
0
Comment
Question by:amucinobluedot
2 Comments
 
LVL 5

Accepted Solution

by:
dannygonzalez09 earned 500 total points
ID: 39642056
you can do this to convert a numeric or integer column to string

SELECT '"' + CONVERT(VARCHAR(10),IntegerColumnName) + '"'

what i'm doing here is inserting " (double quotes with in single quotes) and concatenating it with integer column convert to a string

change the integerColumnname with your numeric or integer column and you can also change the length to what ever you want ex: VARCHAR(10) to VARCHAR(50)
0
 

Author Closing Comment

by:amucinobluedot
ID: 39642102
:)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now