I recently added Items to an ID and the the table got messed up in the transfer process so I deleted the Items from the table. Upon reentering the data instead of the ID starting at one it now starts at 332. I would like to have the table start at one instead of 332. I've removed the data from the data so it's clear. How do I reset the I...
I'm using MS SQL Server but welcome comparitive solutions from other databases.
This is the basic form of my query. It returns the number of calls per day from the 'incidentsm1' table:
SELECT
COUNT(*) AS "Calls",
MAX(open_time),
open_day
FROM
(
SELECT
incident_id,
opened_by,
open_time - (9.0/24) AS open_time,
DATEPART(dd...
What is the argument for and against putting code in stored procedures with the intention of making the code more maintainable (i.e. Easier to make changes to the business rules without recompiling code)?
All else being equal what makes a stored procedure better/worse for maintenance?
...
I have a class called Player in the business layer of my web application.
Player class has fields PlayerID, CategoryID and CountryID
A function in Player Class calls a function in PlayerDB Class in the Data Access Layer which in turn calls a stored proc which returns data for PlayerID, CategoryID (foreign key to Category table) and Cou...
I have 2 table TableA and TableB I want to insert all records at a time from TableA to TableB if the records are not in TableB
Please help thank you
...
I would like to search an entire MS SQL 2000 database for one value. This would be to aid development only. Keep that in mind when considering this question.
This will get all the table names and the column of the data type I'm looking for:
SELECT Columns.COLUMN_NAME, tables.TABLE_NAME
FROM INFORMATION_SCHEMA.Columns as Columns
JOIN ...
I need to calculate the DateDiff (hours) between two dates, but only during business-hours (8:30 - 16:00, no weekends). This result will then be put into the Reaction_Time column as per the example below.
ID Date Reaction_Time Overdue
1 29.04.2003 15:00:00
1 30.04.2003 11:00:00 3...
Hi friends,
Here i am having a table, where status (initially progress) is a column in it. I need to update the status column into "success".
Shall i write a query like this?
Update "tablename" set status='success' where status='progress'
Why i'm asking means? here the update and its where condition are checking the same column.
Is ...
How can I do to get the next row in a table?
`image_id` int(11) NOT NULL auto_increment
`image_title` varchar(255) NOT NULL
`image_text` mediumtext NOT NULL
`image_date` datetime NOT NULL
`image_filename` varchar(255) NOT NULL
If the current image is 3 for example and the next one is 7 etc. this won’t work:
$query = mysql_query("SELE...
How can I change the class name of stored procedure result generated by LINQ to SQL designer (besides messing with designer.cs)?
Also, how can you perform a linq query on the result set of the stored procedure?
...
Is there some kind of tool which lets me do SQL like queries (counting, aggregating, joining,etc) without using a full fledged database?
Preferably it's some kind of commandline tool:
sqlcommandline "select count(*) from file1.csv where bladebla"
...
I'm a sql noob trying to get this query to use 2 tables.
tables & columns are:
person:
department_id,
name,
etc...
department:
department_id,
dept_name,
etc...
I have a 'select' html form that the user will choose a dept_name from, and I need my php script to return every person with a matching department_id. ...
The SQL works fine on most installations. However I'm having a problem with an Oracle installation in Canada (possible date localization issue?).
http://www.google.com/search?q=ORA-01830
I'm feeding data to a proprietary processor that generates the SQL. I only provide data. I was hoping for information that may help me solve it wit...
Seems a common enough problem this, but most solutions refer to concatenating multiple SQL commands, something which I believe can't be done with ADO/VBA (I'll be glad to be shown wrong in this regard however).
I currently insert my new record then run a select query using (I hope) enough fields to guarantee that only the newly inserted...
How can I query my SQL database and find all the duplicate orders where a customer ordered something more than once?
...
I have created an extensibility method for deleting one of my Linq To Sql objects called Reservation.
Well, in this partial method I created, I want to update some other objects. I can't seem to get the update to be persisted in the database. Here is my partial method for deleting the reservation.
public partial class LawEnforcementDat...
I am using Microsoft SQL server 2005. I need to sync data between SQL server and an Oracle db. First thing I need is to find out if the count of data on Oracle side with certain filters(here I use ID as a simple example).
SELECT COUNT(*) FROM oracleServer..owner.table1 WHERE id = @id;
The problem I have is that the table on the lined ...
I have two tables and I need to remove rows from the first table if an exact copy of a row exists in the second table.
Does anyone have an example of how I would go about doing this in MSSQL server?
...
Hi I was wondering when I should use the different data types. As in in my table, how can I decide which to use: nvarchar, nchar, varchar, varbinary, etc.
Examples:
What would I use for a ... column:
Phone number,
Address,
First Name, Last Name,
Email,
ID number,
etc.
Thanks for any help!
...
I'm slowly learning SQL and how to use form builder 6. The situation is I have a simple table named 'players' within the table I have three columns:
player_no (primary key)
position
goals
Within form builder 6 I have created a very simple form using these three fields. The form is named 'TEAM'. At at the foot of the form I have a but...