How to convert second select statement result to CSV String in main select statement ?
assume following SQL statement:
SELECT A1,A2, (SELECT aCol FROM Table2) as A3
FROM Table1
Now, I want to convert result of SELECT aCol FROM Table2 to CSV string that show at A3 field.
such as :
A1Value | A2Value | A3Value1, A3Value2, A3Value3
th...
If I have a table like this...
create table #words (
id int identity,
word varchar(1024)
)
insert into #words (word) values ('dock')
insert into #words (word) values ('dockable')
and i do a LIKE query
select id, word from #words where word like '%dock%'
Is there a way to tell which result would be the most accurate?
...
When trying to expand the tables on a database in the object explorer I get the following error:
“A severe error occurred on the current command. The results, if any, should be discarded.
”
The database was recently restored from a SQL server 2000 box. I can see two tables that are in the sysobjects catalogue but I can not drop or sel...
Hello,
EDIT: I think it's a problem on the subquery on the LINQ-generated query, it get all the records... But I don't know how could I fix it
I have made a simple ASP.NET MVC 2 application that does SELECT queries on a view, I get really poor performance, and while doing a simple benchmark with jMeter (10 conccurents connection) while...
We currently have a system that displays a page tabular data on the screen without any paging support in the user interface. It is running on Java 1.5 / Spring JDBC / T-SQL stored procs / SQLServer 2000 stack.
In the absence of the ability to skip rows in the result set (limitation of SQLServer 2K without using dynamic SQL); I am explo...
Hi,
Does anyone know the least windows account previlege to run under "credentials stored securely in the report server" option in the report manager?
I have tried to create a windows account with admin right and assign to "credentials stored securely in the report server" option but didn't work. However I enter administrator account, ...
Hello
How to loop through / access values of RecordSet Destination in SSIS Script Task.
Thanks
...
Hi
Similar questions have been asked before but after a day of going through the answers I'm still very confused.
I'm using Microsoft's Sync Framework with SQL2008 on the server and SQL CE on Windows Mobile devices. I would have thought this was a VERY common requirement. I don't want to replicate large tables onto the mobile device....
I would like to get 50 as the output instead of 0.
...
I want to be able to send reminders for appointments. Given the tables:
- Appointment
ID (PK)
Start
- Reminder
AppointmentID (FK)
MinutesBeforeAppointmentToSendReminder -- only need minute resolution
I would like to select reminder times:
select ..., DateAdd(minutes, -Reminder.MinutesBeforeAppointmentToSendReminder, Appoint...
I am creating sql queries and I have read in one book that when using NOT operator or LIKE operators Indexes do not work. How much true this statement is. How can we avoid this if the statement is true. How a query should be made to do the same work avoiding these operators.
What all other areas are there in sql server where Indexes are...
Hi, I use SQL Server 2008
I use a CHECK CONSTRAINT on multiple columns in the same table to try to validate data input.
I receive an error:
Column CHECK constraint for column
'AAAA' references another column,
table 'XXXX'.
CHECK CONSTRAINT does not work in this way.
Any other way to implement this on a single table without ...
I have an Exec SQL Task that runs a simple select statement but is it possible to capture the result value and to map the resulting value to a variable?...i've tried but have not been successful [Sad]
...
Hi,
I am fairly new to SSAS and SQL Server but Google didn't help. I am grateful for pointers to the right documentation.
I have setup a cube and I query it from Excel using pivot tables.
The very first update/request I run takes around 10 secs to run, however the following request complete in less then a second.
When I wait a while ...
Hi,
I have a System DSN configured and test ok :
Microsoft SQL Server Native Client Version 10.00.2531
Data Source Name: xxx Data Source
Description: xxx Server: SERVER\SHARE
Use Integrated Security: Yes Database:
yyy Language: (Default) Data
Encryption: No Trust Server
Certificate: No Multiple Active ...
I have a CSV File, from that file i have to consider only two columns suppose A & B.
Now my requirement is Map all the values which are there in the column A from the CSV to the table and update other column in the table with the values from Column B.
So far, i have created a DataTable which has these two columns. But I dont know how t...
We are in the process of upgrading our sql server to 2K8 R2 and the output of a FOR XML AUTO query has changed.
The query outputs columns from three tables
The resultset returns three rows which each column is identical bar the last two columns from the third table. the results used to show as below
<element1 myval="Test">
<elemen...
Part of our company has moved to another area and they are being set up as a separate domain. The users can VPN in to our domain to run the app, but when they try to access the database it fails, because SQL Server is set for Windows Authentication, and they are on a different domain. It is a Windows C# app, we are using SQL Server 2005 ...
Hi,
I would like to know if there is a way to use an order by clause when updating a table. I am updating a table and setting a consecutive number, that's why the order of the update is important. Using the following sql statement, I was able to solve it without using a cursor:
DECLARE @Number INT = 0
UPDATE Test
SET @Number = Number ...
Hi,
I am looking to set up 6 groups into which customers would fall into:
Non-purchaser (never bought from us)
New purchaser (purchased for the first time within the current financial year)
Reactivated purchaser (purchased in the current financial year, and also in the 2nd most recent year)
Lapsed purchaser (purchased in the prior finan...