Forum: MS SQL May 29th, 2009 |
| Replies: 3 Views: 536 I think a self join is required:
select distinct
d1.id
from dtlstbl as d1
inner join dtlstbl as d2
on d1.id = d2.id
and d2.refid = 2
where |
Forum: MS SQL Mar 25th, 2008 |
| Replies: 3 Views: 2,496 A quick and dirty method would be to select into a temp table that has a identity column and then use that as the basis for your query. I wouldn't use this method if performance is high on your... |
Forum: MS SQL Jan 21st, 2008 |
| Replies: 2 Views: 727 Books Online (http://msdn2.microsoft.com/en-us/library/aa257103.aspx) is probably a decent way to start.
Also I suggest trying some queries with the Northwind database; work out how to add... |
Forum: MS SQL Dec 29th, 2007 |
| Replies: 5 Views: 1,031 sqlite (http://www.sqlite.org/) is exactly what you're after.
"...SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite... |
Forum: MS SQL Dec 29th, 2007 |
| Replies: 2 Views: 877 I hope you didn't quit your day job. |
Forum: MS SQL Sep 11th, 2007 |
| Replies: 1 Views: 1,157 Create a job, insert what you get from your query into another table. |
Forum: MS SQL May 9th, 2007 |
| Replies: 2 Views: 1,135 Don't store images in your database; you're best storing them on your file system and storing their location/filename in the database
name | age | image... |
Forum: MS SQL Apr 19th, 2007 |
| Replies: 1 Views: 2,468 try grant select on sales to sqluser
If you look up the grant function on msdn you can finely tune the privileges for each table/database/user/whatever. |
Forum: MS SQL Mar 21st, 2007 |
| Replies: 5 Views: 1,892 Limitation of SQL server I presume (I use PostgreSQL).
Here is an ugly way to do it
select *
from t1
where task not in (select task1 from t2)
and task not in (select task2 from t2) |
Forum: MS SQL Mar 21st, 2007 |
| Replies: 5 Views: 1,892 Ok,
For this I've called the tables t1 and t2.
select *
from t1
where task not in (
select task1
from t2 |
Forum: MS SQL Mar 21st, 2007 |
| Replies: 5 Views: 1,892 Hi,
Could you give us the names of the columns? I'm not sure I understand exactly what you're doing. |
Forum: MS SQL Feb 19th, 2007 |
| Replies: 13 Views: 27,131 duplicate of what? all duplicates? why don't you have a unique identifier? do you have any validation? why are you here? why am i answering you? |
Forum: MS SQL Feb 8th, 2007 |
| Replies: 5 Views: 2,118 I don't think there is anything wrong with updating two tables using two statements.
If you wrap them in a transaction you will ensure that you don't only update one (ie if one fails neither are... |
Forum: MS SQL Feb 7th, 2007 |
| Replies: 5 Views: 2,118 ALTER PROCEDURE UpdateAccounts
@contactID int,
@accountID int
AS
begin transaction
UPDATE [Contact Account ]
SET [Account ID] = @accountID
WHERE [Contact ID] = @contactID
UPDATE... |
Forum: MS SQL Jan 31st, 2007 |
| Replies: 1 Views: 2,989 AFAIK MSSQL does not support partial indexes (like PostgreSQL, Teradata, Oracle etc).
You may be able to get the functionality you require using a indexed view. |
Forum: MS SQL Jan 3rd, 2007 |
| Replies: 2 Views: 6,490 Storing movies in the actual database will impact its performance hugely.
I think the approach you should be taking is storing the location of the file in the db and storing the file on the file... |
Forum: MS SQL Oct 20th, 2006 |
| Replies: 5 Views: 5,089 SELECT RNO,PNAME,AGE,'discharged' as STATUS
FROM TAB1
WHERE enroll_status = 'D'
union
SELECT RNO,PNAME,AGE,'queued' as STATUS
FROM TAB1
WHERE enroll_status = 'Q'
union
SELECT... |
Forum: MS SQL Oct 2nd, 2006 |
| Replies: 1 Views: 2,117 may be typos here but you should try not to use square brackets in your sql; makes it much harder to read
also it is easier to join tables in the from clause rather than where, it makes more... |
Forum: MS SQL Sep 20th, 2006 |
| Replies: 2 Views: 5,310 I don't know much about access (except to avoid it).
It was SQL I'd suggest you look at the convert() function in tsql.
I don't really get what you mean with your data conversion either but you... |
Forum: MS SQL Sep 5th, 2006 |
| Replies: 1 Views: 2,818 select top 1 with ties your_column
from your_table
group by your_column
order by count(*) desc |
Forum: MS SQL Sep 4th, 2006 |
| Replies: 3 Views: 11,622 your auto-incrementing id field |
Forum: MS SQL Jul 31st, 2006 |
| Replies: 1 Views: 1,714 SELECT product,max(transaction_date)
FROM tbl
GROUP BY product (http://msdn2.microsoft.com/en-us/library/ms177673.aspx) |
Forum: MS SQL Jul 17th, 2006 |
| Replies: 2 Views: 2,893 select id from mytable mt where (mt.id % 5) = 0 |
Forum: MS SQL Jul 11th, 2006 |
| Replies: 7 Views: 6,024 select @newrowcount = 'NUM'
from ExcelToSql
where NUM = @rowcounter
this bit is wrong. it should be :
selec @newrowcount = NUM |
Forum: MS SQL Jul 4th, 2006 |
| Replies: 7 Views: 6,024 missed the from and where clause off the select
use barcodedb
declare @rowcounter integer,
@rowcount integer,
@newrowcounter integer,
@newrowcount integer |
Forum: MS SQL Jul 3rd, 2006 |
| Replies: 7 Views: 6,024 ok, i'm assuming you have an id column as your pk
i probably have loads of errors in here but don't have mssql to try it with, hopefully what im doing is apparent though.
declare... |
Forum: MS SQL Jun 17th, 2006 |
| Replies: 1 Views: 14,941 this (http://support.microsoft.com/kb/q164485/) article on Microsoft's support site may help |
Forum: MS SQL May 20th, 2006 |
| Replies: 2 Views: 1,572 |
Forum: MS SQL Apr 17th, 2006 |
| Replies: 4 Views: 8,489 i dont use SQL Server much these days, but is there not a isNumber() or isNumeric() function?
If there isn't im sure writing your own wouldnt be that difficult. Just attempt to cast a varchar as... |
Forum: MS SQL Nov 20th, 2005 |
| Replies: 4 Views: 4,119 i think the best way to tackle this is to make a stored proc that does the check and put the details of the birthday people in a temp table, once you've got them all use xp_sendmail... |
Forum: MS SQL Nov 18th, 2005 |
| Replies: 5 Views: 73,759 that would work if
a) the values were in another table
b) and they werent in a comma delimited list as per the original question :) |
Forum: MS SQL Nov 16th, 2005 |
| Replies: 4 Views: 2,465 no problem, but with your solution i don't understand why you use an if..else statement here
im sure you'd get the same result by just saying
select NoOfVacancies, JobRole
from JobVacancy... |
Forum: MS SQL Nov 16th, 2005 |
| Replies: 2 Views: 4,335 I don't think you need to implement raid to solve this issue (it would do, albeit expensively), adding a new hard disk and creating new filegroups on it would be sufficient. Creating file groups and... |
Forum: MS SQL Nov 13th, 2005 |
| Replies: 4 Views: 2,465 select
NoOfVacancies,
JobRole
from JobVacancy
where (JobRole like @JobRole + '%')
or (JobRole is null) |
Forum: MS SQL Oct 31st, 2005 |
| Replies: 5 Views: 73,759 i'd imagine making a stored procedure to deal with the inserts would be the easiest way.
you can modify this sp to scroll through the list and put the whole lot of your list into variables then... |