sql

How to search and insert a value using java code?

String link = "http://hosted.ap.org"; I want to find whether the given url is already existing in the SQL DB under the table name "urls". If the given url is not found in that table i need to insert it in to that table. As I am a beginner in Java, I cannot really reach the exact code. Please advise on this regard on how to search t...

What SQL data type does Oracle assign to "count(*)"?

What SQL data type does Oracle assign to count(*) in a query like select count(*) from table? Does this depend on the count size? ...

What Java data type corresponds to the Oracle SQL data type NUMERIC?

What Java data type does the Oracle JDBC driver assign to the Oracle SQL data type NUMERIC? Does this vary with the size of the NUMERIC type? ...

How do I concatenate two similar tables on a result

I have two tables with similar columns. I would simply like to select both tables, one after another, so that if I have 'x' rows on table1 and 'y' rows on table2, I'd get 'x + y' rows. ...

Catching SQL Exceptions in vb.net

Is there a way to catch all SQL exceptions in a project? I have several gridviews and multiple sqldatasources and most of the errors are going to occur when a user enters something incorrectly or in the wrong column. So how do I stop the Server Error in /Project page from showing up? ...

SQL Functions - factorial

I am a beginner in SQL Functions. What is the best way to create a function for factorial in SQL Server- Say 10! ...

Executing a stored procedure over ODBC

I have an application that allows the user to enter an SQL string with a placeholder for certain values my application produces. The application will the replace the placeholders with values and execute the SQL string through various database backends. For the ODBC backend, I call SQLExecDirect() on the SQL strin which works nicely on r...

Violation of PRIMARY KEY constraint Cannot insert duplicate key in object . In C#.net....Visual Studio 2010...framework 3.5...

I'm Developing a small windows application in C#.net....Visual Studio 2010...framework 3.5... i use Linqtosql for database manipulation..... table name:cprofile Fields of the table are: custid int (primary key), custname varchar(50), address nvarchar(MAX), mobileno nchar(10) So i hav...

[SQL] how to query and group by specific attribute?

I have some data that store in my DB such as: id nid name 1 111 john 2 111 bill 3 222 tom 4 111 boy 5 111 girl 6 111 tim 7 333 jone 8 222 mike . . . and I need to query all id and then grouping all by nid. the expected result is id nid name 1 111 ...

setting up a default value of a column in select statement

hi actually i have 2 tables table1 and table2 table1 name city addr. table2 name city addr. ph.no now ph.no field is an extra field in table 2 so i want to show field ph.no with a default value of 12345 in the output of select query on table1 as i want to append that output into an outfile. help me out ..I am using db2 as400 dat...

Select multiple distinct fields, and summing another field

I have a table where I have 6 columns. 5 of these columns I have to make sure that I don't have any duplicates. So I used the statement: SELECT SUB_ACCT_NO_PAJ, CustomerType, POST_DTE_PAJ, IA_DateYear, ADJ_RSN_PAJ, count(*) AS [aCount] INTO TempTable1 FROM All_Adjustments GROUP BY SUB_ACCT_NO_PAJ, CustomerType, POST_DTE_PAJ, IA_DateYe...

Query to select subcategories of categories of destinations which are active?

I have a table of destinations ( states ) which contain primary level categories and subcategories for activities. My ultimate goal is to output xml navigation links so I can link to: Each destination permalink ( ordered alphabetically by destination slug name ) Each category underneath Each subcategories underneath the category The ...

Loading google maps markers faster dynamically

I'm trying to generate a Google Map based off of results from a database. I can get the addresses geocoded and put out on the map, but I'm not able to do it very quickly. I have a setTimeout function to help with loading the markers; if i do not include it then not all of the markers will load. Is there any way for me to push out the m...

Triangular Multiplication Matrix generation

Trying to generate a Triangular Multiplication Matrix IN T-SQL- Like a triangular multiplication matrix will look like this: 0 0 1 0 2 4 0 3 6 9 0 4 8 12 16 I have not been able to find an efficient solution for this. Any help is appreciated. ...

How to backup a Solr database?

I wonder how to backup (dump) a Solr database? If it is only to copy some files, then please specify which files (filename, location etc). Thanks ...

exporting SQL from a Viso diagram

Is there a method to export SQL statements from a Viso 2003 entity-relationship diagram? ...

Count Unique Results in T-SQL

My query is: SELECT DISTINCT IncidentStatus.IncidentStatusName, Incident.IncidentID AS Bob FROM Incident INNER JOIN IncidentMember ON Incident.IncidentID = IncidentMember.IncidentId INNER JOIN IncidentStatus ON Incident.IncidentStatusID = IncidentStatus.IncidentStatusID WHERE ...

Which hosting plan is Suite ?

I'm just confused in choosing hosting plan for one of my customers web sites. currently we have: 60,000 visits/month 420,000 Pageview/Month Maximum 400 MB SQL space And about 60 GB transfer/month Web is ASP.NET 4.0 and SQL Server 2008. It is now in a share hosting and there is not problem with performance. In fact for SQL space a...

Identify column-level dependencies between databases

Is there a way to identify column-level dependencies within and between databases? I'd like to generate a report of all columns in a database that are unused by anything (views, procs, UDFs). e.g. In database 'DB1', there is a table with a column called 'col1'. How do I determine if 'col1' is being used by procs, views or UDFs in eit...

SQL constraint for between multiple values

Here is my table Events Start : Datetime End : Datetime I'm trying to make sure that a new Event does not overlap any previously entered events. I'll admit my SQL knowledge is novice at best. The following is a select statement that gets me close but I can't figure out how to turn it into a constraint (would I use check?) SELECT e....