sql

How do I reset the Primary Key index to 1 using Visual Studio 2008 Server Explorer?

How do I reset the Primary Key index to 1 using Visual Studio 2008 Server Explorer? Thanks! ...

How to ALTER a view in PostgreSQL

Folks, PostgreSQL does not allow altering a view (i.e. adding column, changing column orders, adding criterie etc.) if it has dependent objects. This is really getting annoying since you have to write a script to; Drop all the dependent objects Alter the view Recreate all the dependent objects back again I understand that postgreS...

Database Naming Conventions by Microsoft?

I found Naming Guidelines from MSDN, but is it any guideline for MSSQL database from Microsoft? ...

How do you pronounce "Microsoft SQL Server" ?

Possible Duplicate: SQL Pronunciation What is the correct way of pronouncing "SQL" in "Microsoft SQL Server" ? ess-cue-el or sequel I've heard it both ways, but what is the official? ...

MySQL, sorting before a group by

If I issue a query like this: select c1, c2, c3 from table group by c1; i get distinct results for c1, but how do i sort it (e.g. c2 descending) before the group by? ...

Urgent! Need help selecting IDs from a table if 2 conditions in other tables match

Sorry for the worst question title ever but I find it hard to explain in a sentence what im having trouble with. I am developing a user feedback system using ASP.NET and C#. I have multiple tables and am trying to populate dropdown lists so that the feedback can be filtered. My tables: CREATE TABLE tblModules ( Module_ID nvarchar(10) ...

Changing Rails Query to Pure SQL

I'm looking to move the following code away from ActiveRecord to pure SQL for a performance increase. What would be the best way to write this query in pure SQL (MySQL DB)? User.count(:conditions => ["email = ?",params[:email]]) > 0 Thanks ...

Trying to filter datagrid according to selections made in dropdown lists

I have a View Feedback page with two drop down lists to filter the gridview of answers to questions. The 1st ddList is Modules, once this is selected, the 2nd ddList of Questions becomes enabled and the user can select a question to see the answers for it in relation to the module selected, OR they can select to see all answers to all qu...

converting clustered index into non-clustered index?

Is it possible to convert a clustered index to non clustered index or non clustered index to clustered index in sql server 2005. Please convert this query into clustered index: create index index1 on mytable(firstcolumn) Please convert this query into non clustered index: create clustered index clusindex1 on mytable(cluscolumn) ...

Backup MySql database with PHP

I have a pretty large db in MySql, and I need to take backups of it every day or so. I need to be able to take backups from any computer, so therefore I thought about making a php script to do this and put this php script online (offcourse with password protection and authorization etc so that only I can access it). I wonder however, h...

Need help with creating a pl/sql query

Hi Folks! Greetings to all! I want to create a pl/sql query by declaring variables for the following eg: :stay_id = (SELECT Stay_Id from MVStay where StayNumber = 'xxxx' AND StayState = 2); -- get passage linked to the stay and is 'discharged' :passage_id = (SELECT Passage_Id from MVStayWorkflow where Stay_Id = :stay_id and WorkflowActi...

Actual size of TEXT field (MySQL)

Hello. Will a TEXT field use the same storage space in the database no matter if it is empty, got a few characters or filled to the limit? ...

MySQL: Finding multiple words in full text search - exact matches only

I'm writing some code to automatically tag some articles. I have an array of tags and a table of articles. I run the following query to check for headlines matching a tag: SELECT headline FROM `news` WHERE MATCH(headline) AGAINST ("+Green +Day" IN BOOLEAN MODE) This finds all articles with the exact phrase 'Green Day' in the hea...

Why is my CASE expression non-deterministic?

I am trying to create a persisted computed column using CASE expression: ALTER TABLE dbo.Calendar ADD PreviousDate AS case WHEN [Date]>'20100101' THEN [Date] ELSE NULL END PERSISTED MSDN clearly says that CASE is deterministic, here However, I am getting an error: Msg 4936, Level 16, State 1, Line 1 Computed column 'Previo...

Only import tables from a complete MySql database export

If I have exported a .sql file with my database in it, can I then only import "parts" of that database instead of the entire database to MySql? The question appeared when I was trying it out on a test database. I exported the testdatabase. Then emptied some of the tables in the database. Then I planned on importing from the .sql file...

Mysql query return duplicate entries with in and find_int_set

Hello, I have a mysql query that shows the users last viewed documents. Some sort of history view, and I want to show this in a history tab, but I cannot get this to work. The history is saved on another server so I'm getting a list of ID's, and I have to get the document's info from the document database. I want it to show duplicate e...

sql help getting data from all the followers ? ( like twitter if we follow )

example if i have follow table company one ( cid = 1 ) following two ( cid = 2 ) company one ( cid = 1 ) following three( cid = 3 ) feeds table company one ( cid = 1 ) type 'product' description 'hello ive updated a product'; company two ( cid = 2 ) type 'product' description 'hello ive updated a product im from company 2'; company ...

Mysql query - invalid use of group function

mysql_query(" SELECT b.id as b_id FROM banner b INNER JOIN bannerhits bl ON b.id = bl.bannerid AND bl.userid = '".$this->userid."' INNER JOIN ...

using pl/sql how do I open a directory?

using pl/sql how do I open a directory? ...

Returning multiple columns from SELECT nested within CASE MySQL

Is there a better way to do this? SELECT subs. * , CASE subs.member_type WHEN 'member' THEN ( SELECT CONCAT_WS( ' ', members.first_name, members.last_name ) FROM members WHERE members.id = subs.member_id) ELSE ( SELECT members_anon.username FROM members_a...