Solved

Select and convert to string

Posted on 2013-11-12
2
359 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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 INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

685 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