Lets say there is some code that executes the following SQL query:
set rowcount n
But n is unknown. Is there any way to know what n was? I'm using Sybase.
select @[email protected]('*')
for xml raw,type
Above statement will generate following alert:
Msg 6819, Level 16, State 3, Line 2
The FOR XML clause is not allowed in a ASSIGNMENT statement.
Do all deadlocks indicate a problem with the query or does this kind deadlock indicate a problem with something else like SQL mail or something? The stored proc in question uses SQL mail.
This is the query to update table in one database that is of other
Update
test.temp a,
test2.temp b
Set a.name=b.name
Where a.no=b.no;
Now I don't want to write every field i.e a.name=b.name
Is there any solution?
Hi I am using Crystal Reports 10 to generate my reports. In one of the reports I see that a group header is getting repeated 2 times in the output document while in the design tab I can that it is present only one time. I am having my query as a "Union All" of 2 data sets.
Please advise what could be the cause. Thanks.
Having a bit of difficulty figuring out how to create a named_scope from this SQL query:
select * from foo where id NOT IN (select foo_id from bar) AND foo.category = ? ORDER BY RAND() LIMIT 1;
Category should be variable to change.
What's the most efficient way the named_scope can be written for the problem above?
Web pages are, by nature, state-less objects. When you click from page to page in an ASP.net application, each request for a page is treated as a brand-new request. We use things like cookies, session-variables, and query strings to maintain state from page to page.
When you log in to an ASP.net web application using Windows Authentication, how does IIS persist your identity between pages?
Why does
left(FIELD, replace(nullif(charindex('-', FIELD), 0), null, len(FIELD)))
always return null? The idea behind the query is that if charindex() returns 0, then convert the results into null, then convert the null into the length of the field. So if '-' does not exist, show the whole string. For some reason it makes every row equal null.
Thank you.
Hi
I am trying to generate a CSV file from DB Query as source one of my column is having datatype nvarchar(50) with values as "01050007029604301001"
After the export when the csv file is viewed using Excel the value appears as
"1.0500E18" .
How can i stop this .
Please suggest
Hi,
I've got table Articles
ID identity autoincement, IDArticle: nvarchar(100) ,IDCar nvarchar(100), createddate
How to convert this:
SELECT IDCar , MAX(createddate)
FROM Articles
GROUP BY IDCar
to get IDArticle
eg:
1 art1 BWM 5-21-2010
2 art2 BMW 5-24-2010
3 art3 BMW 5-31-2010
4 art4 Porshe 5-31-2010
5 art5 Porshe 6-1-2010
Expecting result is:
art3
art5
It's not duplicated with:
http://stackoverflow.com/questions/2736769/sql-query-number-of-occurance/2736809#2736809
Hello!
To empty database table, I use this SQL Query:
TRUNCATE TABLE `books`
How to I Truncate table using Django models and orm?
I've tried this, but it doesn't work:
Book.objects.truncate()
When user opens a form to modify a record, but instead of changing information, he just clicks the Update button. Which causes the update() function to return 0. However, I consider this case a valid update task. How would I test it, so I can assign a success message?
Is update() returns -1 when SQL query failed or also 0?
Method: Zend_Db_Table_Abstract::update()
Any ideas?
Thanks
There's a way to get which fields were modified after a update query?
I want to keep track what field XXX user modified... any ways using active records?
I have two variable TO_DATE and FROM_DATE. My table has two fields DOJ and DOL. I want to select all the records whose DOJ < TO_DATE and DOL FROM_DATE.
How can i write an SQL query in for this??
My database has about 30 views, most of which have a reference to another database on this server (call it DB1).
Now, without going into the reasons why, I need to update all those views to DB2, also on the local server.
I would hate to have to do this manually on each view. Is there some SQL query I can run that will replace all occurrences of the string 'DB1' with 'DB2' in all my views?
Using SQL ManagementStudio 2008 I created SQL 3.5 Compact DB (TestCompact.sdf) and I have created subscription to existing Publication. Using SQL Management Studio it is working. I have transfered TestCompact.sdf to Windows Mobile 5 emulator device and with QueryAnalyzer for Mobile I could query existing tables in TestCompact.sdf. I don't know how to start replication synchronization on that mobile device. Do I need to write some C# code or it is possible do it more simple?
I have the following XML:
<tests>
<test>1</test>
<test>2</test>
<test>3</test>
</tests>
And I am trying the following query:
CREATE PROCEDURE [dbo].[test]
@Tests xml=null
AS
BEGIN
SELECT
doc.col.value('(test)[1]', 'nvarchar(50)')
FROM
@Tests.nodes('//tests') AS doc(col)
END
But it only returns me a value from the first
What am I missing here?
Hi ,
I have column which consists of path for example \Abc\F\E\record_123 , now i need to update the path in database where only one change i need to do is tht
\Abc\F\E\record_123 = \Abc\F\G\record_123 - i want to update E to G .
how to do that with update query in database .
Can anyone help me its urgent.
Thanks
Smartdev
hi,
i am using autocomplete with oracle Db,how to create unique keyword for the table.
KEYWORD VARCHAR2(100)
COUNT NUMBER(18)
how can i make as unique
can plz tell the query
i need write a select query to find the number of rows which have an empty fulltext field but for some reason both:
select count(id) from table where field is null;
and
select count(id) from table where field = "";
don't seem to work!
what else is there?!
function get_ibo_id() {
if($registerquery = $this->conn->query("SELECT ibo_id FROM fasttrack WHERE count <
8 && flag = 1 ")){
$this->increase_count();
while ($row = $registerquery->fetch_assoc()) {
return $row[ibo_id];
}
}
else return "No id";
}
it always enters the if block even if the condition is not satisfied... going crazy
i am clicking a button on a form in access:
Private Sub Command29_Click()
some_variable = 2
stDocName = "test"
DoCmd.OpenQuery stDocName
End Sub
my query looks like this:
SELECT *
FROM [some_table]
WHERE [Occurrence Number]=some_variable;
is this possible to do?
I want to make this kind of query:
create procedure something
@name varchar(13)
as
begin
select * from WORKER
where NAME LIKE "%@name%"
end
For input @name=ho, I want output every row that contains NAME wich sounds "ho",
for example HOuse, soHO, broHOw...
Hi i've wrote a query that works:
SELECT `comments`.* FROM `comments`
RIGHT JOIN (SELECT MAX( id ) AS id, core_id, topic_id
FROM comments GROUP BY core_id, topic_id order by id desc) comm
ON comm.id = comments.id LIMIT 10
I want know if is possible and how rewrite it for get better performance.
thanks
I have the requirement of updating an app to use multiple (i.e., two in this case) datasources depending upon the type of query. For instance, use DB1 for reads and DB2 for write operations. How would I approach this?