How do I reset a sequence in Oracle?
In PostgreSQL, I can do something like this: ALTER SEQUENCE serial RESTART WITH 0; Is there an Oracle equivalent? 18 Answers 18
In PostgreSQL, I can do something like this: ALTER SEQUENCE serial RESTART WITH 0; Is there an Oracle equivalent? 18 Answers 18
What is the simplest SQL query to find the second largest integer value in a specific column? There are maybe duplicate values in the column. 46 Answers 46 SELECT MAX( col ) FROM table WHERE col < ( SELECT MAX( col ) FROM table )
I’m converting a db from postgres to mysql. Since i cannot find a tool that does the trick itself, i’m going to convert all postgres sequences to autoincrement ids in mysql with autoincrement value. So, how can i list all sequences in a Postgres DB (8.1 version) with information about the table in which it’s … Read more
I have a constraint called users.SYS_C00381400. How do I find what that constraint is? Is there a way to query all constraints? 3 Answers 3
I’m looking to be able to run a single query on a remote server in a scripted task. For example, intuitively, I would imagine it would go something like: mysql -uroot -p -hslavedb.mydomain.com mydb_production “select * from users;” 7 Answers 7
I want to do a case sensitive search in my SQL query. But by default, SQL Server does not consider the case of the strings. Any idea on how to do a case sensitive search in SQL query? 11 Answers 11
I was trying to create a table as follows, create table table1(date1 datetime,date2 datetime); First I tried inserting values as below, insert into table1 values(’21-02-2012 6:10:00 PM’,’01-01-2001 12:00:00 AM’); It has given error saying, Cannot convert varchar to datetime Then I tried below format as one of the post suggested by our stackoverflow, insert into … Read more
I’m working on the design for a RoR project for my company, and our development team has already run into a bit of a debate about the design, specifically the database. We have a model called Message that needs to be persisted. It’s a very, very small model with only three db columns other than … Read more
Entering the following command into a PostgreSQL interactive terminal results in an error: ALTER TABLE tbl_name ALTER COLUMN col_name varchar (11); What is the correct command to alter the data type of a column? 3 Answers 3
How to copy/append data from one table into another table with same schema in SQL Server? Edit: let’s say there is a query select * into table1 from table2 where 1=1 which creates table1 with the same schema as well as data as in table2. Is there any short query like this to only copy … Read more