Hi friends,
While updating a datatime column in a table from another table, i noticed that mnilliseconds value are not shown.. instead it is rounded and the value is updated to nearest seconds.
Example :
Original Value: 2008-06-26 14:06:36.643
Updated Value : 2008-06-26 14:07:00
Please help me getting the actual value including mil...
Let's say there's a SQL job that runs a stored procedure every one minute.
What happens, if it takes more than a minute? Does it start the procedure again (having 2 of them running in the same time) or it waits for the previous to finish?
...
Hello,
I have a table containing 110GB in BLOBs in one schema and I want to copy it to another schema to a different table.
I only want to copy a column of the source table so I am using an UPDATE statement, but it takes 2,5 hours to copy 3 GB of data.
Is there a faster way to do this?
Thank you
update:
The code I am using is very...
If I have a common table expression for a family with mother & father, how can I increment the 'Generation' counter? A family should have the child as generation zero, parents as generation 1, and the four grandparents as generation 2. But the loop is performed twice, one for each set of grandparents.
;WITH FamilyTree
AS
(
SELECT ...
Hi All,
According to the following section of BOL:
How to: Use Source Control with SQL Server Management Studio
If you have a source control client installed you should be able to choose it in the plug-in selection. I have both source control clients for Visual Studio 2005 and 2008 (tfs2005) installed and there's no plug-in to choose ...
Suppose a
Table "Person" having
"SSN",
"Name",
"Address"
and another
Table "Contacts" having
"Contact_ID",
"Contact_Type",
"SSN" (primary key of Person)
similarly
Table "Records" having
"Record_ID",
"Record_Type",
"SSN" (primary key of Person)
Now i want that when i change or update SSN in...
I have a table which is some thing like below..
Date ID
2009-07-01 1
2009-07-01 2
2009-07-01 3
2009-08-01 4
2009-08-01 5
2009-08-01 6
2009-09-01 7
2009-09-01 8
2009-10-01 9
2009-10-01 10
2009-11-01 ...
I have the following query:
SELECT COUNT(*)
FROM Address adr INNER JOIN
Audit a on adr.UniqueId = a.UniqueId
on a database (1.3 million addresses, more than 4 million audits)
both UniqueId columns are clustered primary keys
The query is taking quite long to complete. I feel dumb, but is there any way to optimize it? I want t...
I have two tables and I want to get all records from one table that are different from the records in second table.
Eg.: if we have four records in the first table like A,B,C,D and three records in the second table thats A,B,C then the answer of query should be D.
I have tried "EXCEPT" operator but it doesn't work fine. Kindly help me ...
I want to sort a table in sql server. Condition that i need to fulfill is this
I have a table that has some records in it like this
Select One
None
Child
Old
Neutral
..
..
..
i want it to be sorted in such a way that Select One comes up and None comes at the end and remaining gets sorted alphabetically.
Select One
Child
Neutral
Old
....
Background:
I have a site built in ASP.NET with Sql Server 2005 as it's database. The site is the only site on a Windows Server 2003 box sitting in my clients server room. The client is a local school district, so for data security reasons there is no remote desktop access and no remote Sql Server connection, so if I have to service the...
Total records in table are 10.
Select count(ID) from table1 where col1 = 1 (Result is 8)
Select count(ID) from table1 where col1 = 0 (Result is 2)
So its a same table but count is based on different condition. How am i gonna get two results (counts) using one select statement?
Also Performance is a big concern here.
PS: I am using ...
Hi,
My issue is that I've got update triggers on an SQL View (MS SQL 2005) which I'm mapping to LINQ to SQL entities in C#...
My SQL looks correct but it complains about trying to insert a null value into a secondary table PK field.
I believe my issue relates to having the primary key and identity as separate fields in the primary tab...
I was wondering if its possible to have some kind of SQL error reporting that sends me an email that includes the error and the website that it's been found on.
I'd like to take this precaution because of hosting multiple drupal systems.
There is a PHP error variant:
http://drupal.org/project/php_errors
Hope you guys know a way to be...
Hi,
I have the following 3 tables:
1) Sweetness Table
FruitIndex CountryIndex Sweetness
1 1 10
1 2 20
1 3 400
2 1 50
2 2 123
2 3 1
3...
Currently I have a sql call returning a dataset from a MSSQL database and I want to take a column from that data and return ID's based off that column from the ORACLE database. I can do this one at a time but that requires multiple calls, I am wondering if this can be done with one call.
String sql=String.Format(@"Select DIST_NO
FRO...
Hi,
I've got a couple of Linq to SQL entities which are causing me problems:
[Table(Name = "ViewName")]
[InheritanceMapping(Code = false, Type = typeof(Entity1), IsDefault = true)]
[InheritanceMapping(Code = true, Type = typeof(Entity2))]
public class Entity1
{
[Column(AutoSync = AutoSync.OnInsert, DbType = "uniqueidentifier NOT NULL",...
Given a table that has three columns
ID (Primary Key, not-autoincrementing)
GroupID
SomeValue
I am trying to write a single SQL INSERT INTO statement that will make a copy of every row that has one GroupID into a new GroupID.
Example beginning table:
ID | GroupID | SomeValue
------------------------
1 | 1 | a
2 | 1 ...
Hi,
I want my unit tests suite to load a SQL file in my database. I use a command like
"C:\Program Files\PostgreSQL\8.3\bin"\psql --host 127.0.0.1 --dbname unitTests --file C:\ZendStd\www\voo4\trunk\resources\sql\base_test_projectx.pg.sql --username postgres 2>&1
It run fine in command line, but need me to have a pgpass.conf Since ...
here is my SQL statement , i would like to find all the games that have the status 0 and names of teams that are like key_word or the sport's name that are like the key word.
The problem is that all the games that are displayed don't have status 0 .
What am i doing wrong?
sql="select * from games where games.status=0 and games.team_2_id...