SQL Query Questions and Answers

Recent IT Questions

61 - 80 of 85

Writing a specific query involving primary keys in SQL

I need to write a query in SQL that will get the fifth-from-last record from my database when either a primary key is defined or no primary at all is defined. How would this query look?

View Answer   |  Sep 11 2008  5:51 PM GMT
SQL, Query, Primary keys
asked by SQL Server Ask the Experts

  2445 pts.

SQL Query

Is it possible to write a query that goes through the entire database to search out a particular phrase to delete it, instead of going table by table? This is on a SQL 2005 Database that was injected. The following appears throughout the database tables: <script...

View Answer   |  Sep 10 2008  8:53 PM GMT
SQL Server 2005, SQL Query
asked by Bosco322

  25 pts.

Can I do create dynamic table while bulk insert ?

Hi, I am Software Engineer, I am using SQL-SERVER, I have a issue with it. I want to write a query to dynamically create a table when using BULK Insert. No of Column is dependent upon no of fields available in first row. Assume that in each row no of column is same.Column name can be any string,...

View Answer   |  Aug 18 2008  4:58 PM GMT
SQL Query
asked by ARUNKUMAR112

  5 pts.

Records with null value not in output

See query: select distinct f2.description Business_Unit, f3.description Department, f4.description Function, a.segment5 Account, f5.description Account_Description, sum(nvl(d.entered_dr,0) - nvl(d.entered_cr,0)) Actual, (Select...

View Answer   |  Aug 15 2008  2:46 PM GMT
NULL, SQL Query
asked by Tams

  5 pts.

How Do I assign a value if a value in the field is empty

In my script (that is not working yet) I want to make sure if "full_value" (a field) is empty in a particular record then the value zero will be inserted. This is working in Access, but I'm trying to rebuild the query in SQL. Thank you. SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1,...

View Answer   |  Aug 13 2008  0:31 AM GMT
SQL, CASE statement, SQL Query
asked by Ilfoprog

  30 pts.

Saving the results of a SQL Server 2005 table query in a XML file

I have data in a table on a SQL Server 2005, and I need to query this table and save the results in a XML file that conforms to a given XSD. Is there an easy way of doing this?

View Answer   |  Jul 23 2008  5:08 PM GMT
Query, SQL Server 2005, SQL Query
asked by SQL Server Ask the Experts

  2445 pts.

Find the employees who earn a salary greater than the average salary for their departments using a SQL query

Find the employees who earn a salary greater than the average salary for their departments using a SQL query

View Answer   |  Jul 18 2008  12:07 AM GMT
SQL Query
asked by Sameera

  5 pts.

Writing a specific query in SQL Server 2005

I have a table called "ticketing" and I want to bring from that table the record with the most current date. What kind of query should I write in SQL Server 2005 to bring up that result?

View Answer   |  Jul 15 2008  8:28 PM GMT
Query, SQL Server 2005, SQL Query
asked by SQL Server Ask the Experts

  2445 pts.

equivalent for crosstab query

Is there any function in MySQL that can create a query similar to crosstab query in MS Access???

View Answer   |  Jul 15 2008  3:06 PM GMT
MySQL, Microsoft Access, SQL Query
asked by Sgheorghian

  5 pts.

Toggling a case sensitive query in SQL Server 2005

It appears that my queries of stored procedures, tables, columns, etc. are case sensitive in SQL Server 2005. Is there a “case sensitive” option that I can toggle on and off?

View Answer   |  Jul 10 2008  5:48 PM GMT
Query, SQL Server 2005, SQL Query
asked by SQL Server Ask the Experts

  2445 pts.

SQL Query

I created a SQL query to restore several databases from a remote location to a test environment. I would like to add a check in the script so that it will not run if connected to certain servers so production databases are not accidentally overwritten

View Answer   |  Jul 9 2008  6:34 PM GMT
Scripting, Database backup and recovery, SQL Query
asked by Asdemers

  5 pts.

Create a sequence called Store_seq with the following values: increment by 10, start with 500

Create a sequence called Store_seq with the following values: increment by 10, start with 500

Answer Question   |  Jul 8 2008  6:34 AM GMT
SQL Query, SQL sequences
asked by VB RD

  45 pts.

Looking for a database name query in SQL

Is there a query in SQL that could return me the name of a database, or whether it is connected to SQL Server or Oracle?

View Answer   |  Jul 2 2008  5:49 PM GMT
SQL, Database, SQL Server
asked by SQL Server Ask the Experts

  2445 pts.

xp_fileexist workd in Query window but doesnt in stored procedure

Hello, I am running on SQL server on my local PC . I am singed onto the PC using a network user. This probelm happens if the SQL server service runs as either Local system or network service. In the server management studio if I go to a query window and enter Declare @result int exec xp_fileexist...

View Answer   |  Jun 26 2008  1:59 PM GMT
SQL Server, Stored Procedures, SQL error messages
asked by Kendo

  5 pts.

sql quries

i m a beginer in computer science.so how can i make grip on oracle sql plus is there any website or any electronic book that contains preset quries on sql which can help me in working in sql i want a guide book which has quries to start and work in sql plus and developer.

View Answer   |  Jun 26 2008  1:21 AM GMT
Oracle, Oracle SQL, SQL Query
asked by Yasir oracle

  5 pts.

Using co-related queries in SQL

How do you use co-related queries in SQL and why would they be useful? Is there any effect on performance when executing a co-related query?

View Answer   |  Jun 18 2008  3:46 PM GMT
SQL, Query, SQL Query
asked by SQL Server Ask the Experts

  2445 pts.

iSeries DB2 SQL subquery to compare yesterday sales to 120 day ternd

Hi, I have an SQL query that I would like to populate with veriable date information each time it runs. If I hard code the dates, I get the results I expect. However, I can not get the date parameters to work with my query. Here's the " Hard coded version (Works) SELECT...

View Answer   |  May 30 2008  2:31 PM GMT
DB2/400, SQL Subselect, SQL Query
asked by MarcGreen

  20 pts.

Return zero when there's no data

I am trying to write a query that I can use to generate an Excel chart to show activity in our database. I have it returning rows for each minute over the previous two hours (no problem). The problem comes when I plot a line chart. If there's no activity in a given minute, there's no row...

View Answer   |  May 20 2008  2:02 AM GMT
SQL, Microsoft Excel, .
asked by DanM

  5 pts.

row_number in sql 2000

how to find out the row_number in sql 2000 like using row_number() function in sql 2005

View Answer   |  May 8 2008  10:51 PM GMT
SQL Server 2000, ROW_NUMBER, .
asked by Rl

  10 pts.

sql query

from this table i have to take those records that have common gridcode and then from these records i have to store the records having maximum area in another table... gridcode state area 13013 rajasthan 50000 13013 gujarat 45000 13014 rajasthan 25000 13014 gujarat ...

View Answer   |  Apr 30 2008  5:50 AM GMT
SQL, SQL Query
asked by Aanshi123

  5 pts.

61 - 80 of 85