Forum: MS SQL Jun 9th, 2008 |
| Replies: 1 Views: 966 Re: dynamic sql query... create table #tmp (Code varchar(255), Price money, Date smalldatetime)
insert #tmp (Code, Price, Date)
select 'ProductA', 12.00, '12/10/2002' union all
select 'ProductA', 12.50, '01/15/2005' union... |
Forum: MS SQL Jun 9th, 2008 |
| Replies: 5 Views: 1,440 Re: MS SQL query using Max create table #tmp (Code varchar(255), Price money, Date smalldatetime)
insert #tmp (Code, Price, Date)
select 'ProductA', 12.00, '12/10/2002' union all
select 'ProductA', 12.50, '01/15/2005' union... |
Forum: MS SQL Jun 3rd, 2008 |
| Replies: 1 Views: 634 Re: Converting MYSQL statement to MSSQL Try this code.
SELECT DISTINCT
COALESCE (s3.ADM_CODE, s1.ADM_CODE) AS Expr1, COALESCE (s3.FULLNAME, COALESCE (COALESCE (CASE s2.shortform WHEN '' THEN NULL
... |
Forum: MS SQL May 11th, 2008 |
| Replies: 6 Views: 754 Re: Problem using JOIN with six tables Try this code
select c.name, isNull(doc_A.Doc_A, 0) as Doc_A, isNull(doc_B.Doc_B, 0) as Doc_B, isNull(doc_C.Doc_C, 0) as Doc_C, isNull(doc_D.Doc_D, 0) as Doc_D
from tUsers u inner join tContacts... |
Forum: MS SQL May 8th, 2008 |
| Replies: 2 Views: 1,629 |
Forum: MS SQL May 1st, 2008 |
| Replies: 1 Views: 705 Re: Sub-Select select top 1 *
from (select *
from (select * from table where columname > '2') X
where columname > '4') Y
where columname > '6'
order by columname desc |
Forum: MS SQL Apr 23rd, 2008 |
| Replies: 2 Views: 1,470 Re: MS SQL Update Query update ABC
set XYZ = left(XYZ, 8) + 'A' + substring(XYZ, 9, 1000)
where XYZ like '%P' and XYZ not like '%A%' |
Forum: MS SQL Apr 21st, 2008 |
| Replies: 2 Views: 1,183 |
Forum: MS SQL Apr 14th, 2008 |
| Replies: 1 Views: 411 Re: Query logic I think you can create identity columns.
create table #tmpTemp
(ID int identity(1,1),
Code varchar(255),
Name varchar(255))
insert #tmpTemp (Code, Name)
select 'A', 'AA' --> replace... |
Forum: MS SQL Apr 10th, 2008 |
| Replies: 2 Views: 575 |
Forum: MS SQL Apr 1st, 2008 |
| Replies: 1 Views: 1,011 |
Forum: MS SQL Mar 19th, 2008 |
| Replies: 2 Views: 951 Re: Depth Travesal Try this code in Query Analyser. It enough for small data. If you want to use for big data, modify the code.
set nocount on
create table #tmpName (ID int, [Name] varchar(255))
create table... |
Forum: MS SQL Feb 14th, 2008 |
| Replies: 2 Views: 1,101 |
Forum: MS SQL Feb 6th, 2008 |
| Replies: 6 Views: 6,408 |