I stored (or think I stored) some text from a textbox that is effectively 'lol\ncats'
In SQL management studio it comes up in the description has 'lol cats'
How can I check if the \n is there or not?
...
I have a view which contains (among other columns) a header "name", and an item "rating" column. The view joins the header to the item table, so the name column from the header is repeated for every item.
I need to run a report on the table; ideally, I would have 5 columns in the sql result; the header "name", and 4 copies of the "ratin...
while (tokens.hasMoreTokens())
{
keyword = tokens.nextToken();
System.out.println("File= "+fileid+" Keyword=" + keyword);
stmt.executeUpdate(
"INSERT into TEXTVALUEINVERTEDINDEX " + "(FILEID, KEYWORD) values ('"
+ fileid + "', '" + keyword + "')"
);
}
This is the loop in which I'm updating the row...
I dont know why this is coming up as invalid and I can not figure it out. I was given a legacy database as my supervisor left and I am in charge until someone comes to replace him. I am trying to run this query...
SELECT tblM.guidRId, SUM(dbo.tblCH.curTotalCost) AS curValue
FROM tblCH INNER JOIN
t...
Assume this simple SQL query:
INSERT INTO table (col1,col2) VALUES (val1,val2),(val3,val4),(val5,val6);
Lets say val3 is invalid value for col1. This would cause psql to abort whole INSERT command - it would not insert (val1,val2) nor (val5,val6) either.
Is it possible to make postgresql ignore this error so it does not insert (val3...
I have a table with two number columns, and a unique constraint over them both. I would like to insert a new pair of values UNLESS the pair already exists. What is the simplest way to do this?
If I do
insert into TABLE values (100,200)
and the pair already exists I get a ORA-00001 error, so I would like to do something like
inser...
I am trying to pull the contents of an AS/400 file back to a data-bound .NET WinForms DataGridView (VS 2010). The query itself is no problem, and I am able to bind everything using the DataSource property of the grid. Data comes back with no issues.
The problem I am having is that all date/time fields come back as string literals, mak...
I am aware of the existence of the RLIKE and REGEX operators, but it seems like they cannot be used for that.
Is there a function or an operator that would help me achieve splitting a text field and selecting it as two or more separate fields:
SELECT $1 as `field_a`, $2 as `field_b` FROM `table` WHERE `field` RLIKE '^(.+):(.+)$';
I a...
I'm following the fairly standard L2S repository pattern, using the following as one of the methods
public IEnumerable<T> GetAllByFilter(Func<T, bool> expression)
{
return _dataContext.GetTable<T>().Where(expression);
}
I'm a bit miffed to see that the call to GetTable appears to literally get the table, with the Where expressi...
How can I order the data and then filter it in TSQL (SQL Server)?
I've tried something like this:
SELECT [Job].*,
ROW_NUMBER() OVER (ORDER BY [Job].[Date]) AS RowNum
FROM [Job]
ORDER BY Rank
WHERE RowNum >= @Start AND RowNum < @End
Doesn't work. I also tried to use a subquery, which throws:
The ORDER BY clause is invalid ...
I'm currently using an SqlDataSource in ASP.NET/C# to let users insert, delete and update entries in a table/gridview. Every event needs to be written to an audit table.
I have easily implemented inserting and deleting - when inserting, the main info audited is just the parameter values of the insert query (e.Command.Parameters[0].Value...
I am getting 2 errors:
1) Incorrect syntax near keyword union
2) Incorrect syntax near ')'
Here is the query:
select count(*) as numUsers, count(r.cabGroupId) as numCompanies from
(select r.newUserId, r.groupId
from reportaccesslogs r full outer myTable d
on r.num = d.num
where (r.r...
I have an Access table of the form (I'm simplifying it a bit)
ID AutoNumber Primary Key
SchemeName Text (50)
SchemeNumber Text (15)
This contains some data eg...
ID SchemeName SchemeNumber
--------------------------------------------------------------------
714 Malcolm ...
I have a table called "changes" which contains a list of record numbers the user has modified on many other tables. I'd like to remove the record referenced by a row in changes (and the changes row itself) in one SQL query.
WITH name AS ( SELECT tableName FROM [changes] WHERE id = 80 ),
number AS ( SELECT changeRecnum FROM [changes]...
I'm running NHibernate and SQL Server CE I am trying to use GUIDs as my ID column. This is the code I already have:
Mapping:
<class name="DatabaseType" table="DBMON_DATABASE_TYPE">
<id name="Id" column="DATABASE_TYPE_ID">
<generator class="guid" />
</id>
<property name="DispName" />
</class>
And this is the cre...
I am making a website where users can post 'Posts' and then users can 'Comment' on these posts. I have a database with 3 tables. One contains User Information, one contains Post Information and the final one contains Comment Information.
I want to set up rules so that if a User is deleted, all of their posts and comments are deleted, an...
SELECT * FROM [makes$] WHERE "Corporate Name"='Champion Enterprises, Inc.'
I'm running this query on an XLS excel file using ADO in VBA. There are about 10-20 records containing this corporate name but it returns EOF.
I'm fairly new to database but I'm certain everything is correct aside from my SQL statement.
If I SELECT * FROM [ma...
For a long time, we've wanted to create a case management system where no history is ever lost. When a change is made, we want to record that change, but have the ability to go back to any point in time and see what the record looked like. I wanted to pose this question to the Stack Overflow community to see what are some ways of doing t...
How can I use C# to stop SQL Server?
...
I have the below LINQ to SQL method that takes an inordinate amount of time to execute yet its SQL counterpart is quite simple and fast. Am I doing something wrong in the LINQ part? I am just trying to return some data to display, read-only, in a Data Grid.
I understand that if the tool doesn't fit don't use it and as such I could j...