Viewing 15 posts - 16 through 30 (of 30 total)
Remi,
That was a good trick. This is one of the reasons why I join these forums. I always learn something new.
April 5, 2005 at 3:19 pm
To solve your problem, you need to make use of dynamic SQL inside your stored procedure. Your stored procedure may look like this:
DECLARE @vSQLStmt VARCHAR(1000)
SET @vSQLStmt = 'update tbl_fred SET...
April 5, 2005 at 10:56 am
I don't believe there is such a SQL Server function but you can try this:
CREATE FUNCTION [dbo].[CountChar] ( @pInput VARCHAR(1000), @pSearchChar CHAR(1) )
RETURNS INT
BEGIN
DECLARE @vInputLength INT
DECLARE @vIndex INT
DECLARE @vCount INT
SET...
April 5, 2005 at 10:47 am
One option to look at is detaching the database from the local SQL server then copying the database files to the development SQL server. If you are going to update...
April 5, 2005 at 10:09 am
Try this one:
SELECT
dbo.tblPERSON.PER_FNAME,
dbo.tblPERSON.PER_SNAME,
dbo.tblPERSON.PER_DOB,
dbo.tblLU_PUP_NCYEAR.NCY_DESC,
dbo.tblPERSON.PER_ID,
dbo.tblPUPIL_ATTEND.PAT_TO_DATE
FROM
dbo.tblPERSON INNER JOIN
dbo.tblPUPIL ON dbo.tblPERSON.PER_ID = dbo.tblPUPIL.PER_ID INNER JOIN
dbo.tblLU_PUP_NCYEAR...
April 5, 2005 at 8:56 am
One thing that you can do is change your NOT IN into EXISTS as such:
NOT EXISTS (SELECT 'X'
FROM tblPUPIL_ATTEND
WHERE tblPERSON.PER_ID = tblPUPIL AND
PAT_TO_DATE IS NULL)
NOT EXISTS...
April 5, 2005 at 8:15 am
Try this one:
exec sp_rename 'matsTable.field2', 'newname', 'COLUMN'
April 5, 2005 at 7:55 am
I guess you will be needing 2 queries for this one. The first one will be the number of compliant records for each RIC and the second one will be...
April 4, 2005 at 11:06 am
Try this one:
SELECT Fund, ISNULL(SUM(CASE WHEN Trans_Type = 'D' THEN Trans_Amount * -1 ELSE 0 END), 0) AS 'Total Debits',
ISNULL(SUM(CASE WHEN Trans_Type = 'C' THEN Trans_Amount ELSE 0 END), 0)...
April 4, 2005 at 10:41 am
You can also try this one:
SELECT *
FROM StudentSubject A
WHERE EXISTS (SELECT 'X' FROM StudentSubject B WHERE A.Student = B.Student AND B.Subject = 'German') AND
EXISTS (SELECT 'X' FROM StudentSubject C...
April 4, 2005 at 8:57 am
Try this one:
CREATE TABLE NewTable (ID INT IDENTITY, MyCol1 VARCHAR(50), Parent INT)
INSERT INTO NewTable (MyCol1, Parent)
SELECT DISTINCT Level1 AS MyCol1, 0 AS Parent
FROM YourTable
INSERT...
April 4, 2005 at 7:50 am
To return the oldest trandate with TranTypeName of 'SaleInTerm', try this:
SELECT CustName, TranTypeName, TranDate
FROM TotalCustTran A
WHERE TranTypeName = 'SaleInTerm' AND TranDate = (SELECT MIN(TranDate)...
April 2, 2005 at 8:50 pm
Try this. I got the desired output...
SELECT x.document_id
FROM (
SELECT document_id, count(*) AS workordercount
FROM @tblDocRef
GROUP BY document_id) x
INNER JOIN
(SELECT a.document_id, count(*) AS workordercount
FROM @tblDocRef a inner join @tblWorkOrder b
ON a.workorder_id...
April 2, 2005 at 12:03 am
How many records are you expecting from the stored procedure? I also encountered problems doing it this way, meaning getting data from one server and writing it to another and...
April 1, 2005 at 11:46 pm
One of the possible reasons for getting this error is when trying to create a table and the statement is using the 4-part table name instead of just the 3-part...
April 1, 2005 at 11:21 pm
Viewing 15 posts - 16 through 30 (of 30 total)