sql

comparing two string arraylists or lists

I have two SQL tables with data that I would like to compare. The tables have the following structures: id, title,url I want to compare the tables by title where if the strings are similar or equal it would be noted by writing the records to a file. Someone suggested not doing it in SQL and copying the data and using it in .net as lis...

Mysql is it faster to use numbers in where clause compared to strings?

Lets say you have 4 types of assessments, Test, Quiz, MiniQuiz and FinalExam and we store records in the database like so studentid ----- assesType 1 test 2 quiz 3 quiz 4 quiz 5 miniquiz 6 miniquiz 7 final 8 final ...

how to check and alter constraints

hi can anyone tel me how to check whether a primary key exists or not in a table and add a primary key if not exixts in sql server compact(.sdf).. i'm using this, IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'PRIMARY KEY') BEGIN alter table [tablename] add constraint [name] PRIM...

SQL update query - Can you not specify the column names?

Hi Is it possible to write a update statement and not give the columns names. For example UPDATE tbl VALUES('1','2','3','4') WHERE id = 1; The number of values will always match the column count. Thanks in advance. EDIT I don't know the column names only the number of columns. I know i could delete the row and then do an insert b...

Howto design a public transport timetable database?

Are there any examples of database design for public transport time-tables ? Or any OpenSource timetable-engine solution? Or if not, how to do it oneselfs? How do I best design the database so that a search can be reasonable fast ? I'd do it like this: For testing, I'd take an X-shaped bus network, with 5 stops (edges and vertex).. ...

Error while creating view in SQL Server 2000

Hello All, I am trying to create a view as following in SQL Server 2000 CREATE VIEW [dbo].[AC_VW0901] AS SELECT CASE T2.ItmsGrpCod WHEN 102 THEN T2.ItmsGrpCod WHEN 103 THEN T2.ItmsGrpCod WHEN 107 THEN T2.ItmsGrpCod WHEN 108 THEN T2.ItmsGrpCod ELSE 100 END AS ItmsGrpCod, CASE WHEN Month(T0.TaxDate) >=4 A...

calculate total number of days in specied dates

i have one table with two columns as shown in picture table columns names are (MAXDATE,AMOUNT). if you see we have first date range (from current date to 20-jan-2010) second date range from 20-jan-2010 to 30-jan-2010 3rd range is from 20-jan-2010 to 31-jan-2010. at the execution of page user enter the start and end dat...

Range for Oracle Date Data Type: "January 1, 4712 BC to December 31, 9999 AD", Does the range has any logic behind it?

Range for Oracle Date Data Type: "January 1, 4712 BC to December 31, 9999 AD", Does the range has any logic behind it? I mean the range has any historic significance or it has something related to programming and memory size etc. I am just wondering, why only from January 1, 4712 BC to December 31, 9999 AD. ...

Optimizing SQL to determine unique page views per user

Hello, I need to determine if user has already visited a page, for tracking unique page views. I have already implemented some HTTP header cache, but now I need to optimize the SQL queries. The visit is unique, when: pair: page_id + user_id is found in the visit table or pair: page_id + session_id is found or: page_id + [ip + userag...

GROUP domain from url in MySql

hello, I have a large database that contains many urls, there are many domains repeating and i;m trying to get only the domain. eg: http://example.com/someurl.html http://example.com/someurl_on_the_same_domain.html http://example.net/myurl.php http://example.org/anotherurl.php and i want to get only domains, eg: http://example.com ht...

How to backup a Solr database to a file?

I have very little information about this, and there isn't much on the web. Does any experienced know how to dump the solr database (index) to a file. I have a Virtual Private Server, where all files are backed up automatically by the provider of the VPS at midnight every day. So, I need to export the Solr index to a file. And IF some...

SQLPlus command line script hangs when inserting records

Using sqlplus 11g on windows to run sql script on 11g database. Sqlplus hangs if insert line left in script. If I comment out the insert line, the script returns the records. Script exec time is < 1 sec when run in sql developer. I have tried to make the insert statment one continuous line with same resutls. using echo on, it hangs r...

problem connecting to access database in asp.net 2.0

hi im trying to get a dataset from an access database im using this connection string: <connectionStrings> <add name="SiteConnString" connectionString="Data Source=c:\inetpub\vhosts\db\mainDB.mdb" providerName="Microsoft.Jet.OLEDB.4.0" /> </connectionStrings> and this is my call to SqlHelper: myDataSet = SqlHelper.Exec...

SmoApplication.EnumAvailableSqlServers fails to return all servers

My application lists the available network SQL Servers using Return SmoApplication.EnumAvailableSqlServers(false) Until recently, I was running XP Pro, with SQL 2005, SQL 2008, and Visual Studio 2008. All worked perfectly, correctly listing the default SQL05 server, and the SQL08 named instance. I've now upgraded to Windows 7 x64, ...

Fields after "ORDER BY" or "WHERE" and index in MySQL

Do Fields after "ORDER BY" or "WHERE" might have index (PRIMARY, UNIQUE, INDEX) in mysql? Consider a table with the following columns: ID | AddedDate | CatID | Title | Description | Status | Editor In these queries, are ID, AddedDate and CatID might have index? SELECT * FROM table WHERE ID = $id SELECT * FROM table ...

error calling nested stored procedures mysql

Hi I m calling a stored procedure inside another stored procedure in MySQL The error i m getting on calling simply using Mysql administrator call sp_update_back_image(2, 3); is: - OUT or INOUT argument 2 for routine void.sp_sel_options_id is not a variable or NEW pseudo-variable in BEFORE trigger The stored procedures... CREA...

How do I create tables in VS 2008?

I am running VS 2008 Standard and SQL Server Express. I created the tables in the Database Designer (creating and xsd), and created the database. How do I get the tables from the Database Designer into the database? Also, is there some documentation available? Thanks! ...

Normalization of an existing SQL database

I have a single-table database I inherited and migrated to SQL Server, and then I normalized it by creating, linking, and filling a whole bunch of lookup-type tables that represented items in the main table. I now want to replace those items in the original table with their foreign keys. Am I stuck writing a bunch of queries or UDF's a...

Debug/visualize database query internal mechanism

I wonder if some open-source SQL database servers have a possibility, how to find out (maybe even in graphical representation), what actually happened inside during the query (e.g. whether table scan was used, or if and which index(es) were used..) step-by-step. It would be useful for database optimization. ...

delete command in vb.net

...