I have tried solving this problem by posting other related questions here that focused on parts of the query. However I might as well post the entire thing and see if anyone can help. I have the following tables with the following fields:
tblPerson - PersonID, PersonName
tblGroup - GroupID, Name
tblGroupMembership - PersonID, GroupID
...
I need to implement a SQL Server replication solution. Very simple need for now. I just need to replicate one pretty simple table from 200 remote sites or so to one central server. The data is not really transactional in nature. I just need it moved up to the central server once a day. I can't decide if I should use push or pull, and I'm...
Hey,everyone
I have a string 'some.file.name',I want to grab 'some.file'.
To do that,I need to find the last occurrence of '.' in a string.
My solution is :
declare @someStr varchar(20)
declare @reversedStr varchar(20)
declare @index int
set @someStr = '001.002.003'
set @reversedStr = reverse(@someStr)
set @index = len(@...
Using SQL Server 2000, I need to insert the deleted records from one table into a second table.
What's the best way to achieve this using a SQL Server 2000 trigger?
with thanks and regards
Sathia
...
Dears
I have the following two table in SQL server 2005 DB
2- "UserInfomration" ---> ( ID (auto) , Name , Gender ( bit ) )
1- "Competitors" ---> ( Id (auto) , UserID ( FK from UserInformation.ID ) , Status ( tinyint)
i want to make a stored procedure that return data as follow
Status - Male count - Female Count
1 ...
If I know the database-name and table-name, how can I find columns-count of the table from sql server master database?
What is the fastest way to find the columns count of any database-table?
What do you think about the performance of this query?
select count(*) from SYSCOLUMNS where id=(select id from SYSOBJECTS where name='Categorie...
Assume a table definition in SQL Server as follows:
CREATE TABLE MyTable (
Id UNIQUEIDENTIFIER NULL,
Info VARCHAR(MAX)
)
And a query:
DECLARE @id UNIQUEIDENTIFIER
DECLARE @info VARCHAR(MAX)
IF @id IS NOT NULL
BEGIN
SELECT @info = Info
FROM MyTable
WHERE Id = @id
END
In that case, the Visual Studio static code analyz...
We have a SQL Server database table that consists of user id, some numeric value, e.g. balance, and a version column.
We have multiple threads updating this table's value column in parallel, each in its own transaction and session (we're using a session-per-thread model). Since we want all logical transaction to occur, each thread does ...
Can anyone think of a reason a SQL Server 2008 failover cluster couldn't use Cluster Shared Volumes for databases and log files?
It seems that using CSVs should reduce failover time and reduce the complexity of the cluster group configurations (the physical drive resources wouldn't need to "failover" anymore).
...
How can I use Checkpoints while I am using For Each Loop containers in an SSIS package? Whenever I try and rerun the package it starts from the beginning of the foreach loop container instead of from where it failed. The checkpoint seems to have trouble with for each loop containers. I created a table insert to help me identify where ...
After reading a lot of articles and many answers related to the above subject, I am still wondering how the SQL Server database engine works in the following example:
Let's assume that we have a table named t3:
create table t3 (a int , b int);
create index test on t3 (a);
and a query as follow:
INSERT INTO T3
SELECT -86,-86
WHERE NO...
We have a website that needs to perform certain actions when a pop-up is being closed.
Note: Not a session end but just a popup being closed.
The solution we found so far, is catching the onunload of the page and then popup a page to perform the actions. When the new popup ends -> it hides itself and everybody's happy.
The problem hap...
We're using NHibernate to update an account table with balance for a user. One test case that stymies us is this:
var s = NHibernateHelper.OpenSession();
var q = s.CreateQuery("Update Account set Balance=? where UserId=? and Version=?");
var acc = s.Load(1);
ITransaction tx = null;
for (int j = 0; j < NUM_UPDATES; j++)
{
int rowcou...
I need to build search conditions to be used with WHERE clause. This search condition is then passed to a different application to be executed as a part of SQL query. Because there search conditions can be quite complex (including sub-queries) I don't believe receiving application can intelligently parse them to prevent SQL injection att...
I have a requirement to update a column with multiple values. The query looks like below.
Update table1 set column1 = (
select value from table2 where table1.column0 = table2.coulmn
)
Is there any generalised stored procedure for a requirement like the above?
...
i have about 140 - 150 stored procedures that I need to migrate from MS SQL 2005 to MySQL 5.1
After succesfully porting 0 of them in the last eight hours I decied to drop by and ask if anyone has any experience, or tips, or knows some util app that can help.
MySQL Administrator is not very helpfull, with a frustrating "MySQL Error numb...
I have a large table (millions of rows) where I need to find groups of records based on the presence of a certain column value and where a specified 'timeout' has not occurred. I figure one approach would be to find across the entire table where these 'timeout' gaps have occurred.
Example table:
+----------------+------+
| time ...
I am trying to accomplish the following:
SELECT col1, col2 FROM table1
UNION
SELECT col2, col3 FROM table2
With the result:
col1, col2, col3
1 , 1 , NULL
NULL, 1 , 1
The union of the columns and the rows is returned. You could think of it as the UNION equivalent of a FULL OUTER JOIN.
The simple answer to this question is:
S...
I'm working on software that has been developed to support two SQL Server versions. We have one version running on SQL Server 2000 and another on 2005. Both are installed on customer sites (two different customers) and I need to be able to get a backup from both servers to do tests for upgrades. The back-ups will then be used to do a fin...
I upgraded from sql server 2000 to 2008 over the weekend. Now one query is running really slow (> 30sec for about 50 rows).
The query is:
SELECT TOP 200 AccData.SurName + ', ' + AccData.FirstNames AS Name,
DATEDIFF(day, COALESCE (AccData.DateReceived, AccData.DateOpened,
AccData.InjuryDate),
GETDATE()) AS Duration, A...