You need to change the datatype to varchar(10) to get the dates as it is in the excel sheet. Then you need to convert it into datetime format so that it has the right month and day.
To create a temp table with the same structure as original table do the following:
1. In SQL query analyser...
select day(datecolumn) as day,
cast(min(ticketno) as varchar(5)) + ' (to) ' +
cast(max(ticketno) as varchar(5)) as ticketnumber, sum(Amount) as TotalAmount
from Table
where month(datecolumn) = 8 /*for august*/
group by day(datecolumn)
order by day(datecolumn)
-Manjari
Hi EO,
Create a temporary table with exactly the same datatype for all other columns in the original table excpet for date coulmn. For date column change the datatype to
varchar(10). Then import the spreadsheet saved under US format into this temporary table.
Then copy the records from...
I am not very familiar with SQL Server 6.5 syntax
Try this:
Declare @MaxCnt int
select @MaxCnt = max(x.Cnt)
from (select membership_no, count(distinct role_no) as Cnt from #Role group by membership_no) x
select A.membership_no, A.First_Name, A.SurName, @MaxCnt as RoleCnt
from #Member A join...
select A.membership_no, A.First_Name, A.SurName, B.Cnt as RoleCnt
from #Member A join
(
select top 1 membership_no,count(distinct role_no) as Cnt from #Role group by membership_no order by Cnt desc
) B
on A.membership_no = B.membership_no
-Manjari
select * from BOLS a
where not exists (select distinct b.BOLNUM, b.ORDERNUM,b.INVNUM from BOLS b join BOLINOB c on b.BOLNUM = c.BOLNUM and b.ORDERNUM = c.ORDERNUM
and b.INVNUM = c.INVNUM and b.BOLNUM = a.BOLNUM and b.ORDERNUM = a.ORDERNUM and b.INVNUM = a.INVNUM)
-Manjari
Is it possible that the table tbl_JobItems is present under two different users in the same database? (i.e., one with your login.Table and ApplicationLogin.Table)??
Try this, Its not clear from your query if year will be same always. If it is same, then just take the difference of month values. Else convert day,month,year into a datetime and get the difference of min, max dates grouped by posgid, upby.
For the user Gerar, if you want 0 months as result...
SELECT State, PType, count(*) as Cnt
INTO #Temp
FROM TABLE1 --(TABLE1 contains ProjectId,ProjectName,Projecttype and State details)
GROUP BY State, PType
order by State, PType
--select * from #Temp
SELECT State,
SUM(CASE PType WHEN 'BedRoom' THEN Cnt ELSE 0 END) AS BedRoom,
SUM(CASE PType...
TRY THIS...The column names and table names in the below query might not match exactly with yours...
select A.TeamId, A.Name1, A.FirstName1, A.Name2, A.FirstName2, A.Discipline, A.number
from
(
select tp1.teamId, p.PersonId, p.LName as Name1 , p.FName as FirstName1,
p2.LName as Name2, p2.FName...
It might be possible that the file you are trying to import into SQL has some extra rows at the end which is causing the NULL value insert.
Try deleting those extra rows from the file and run the DTS package again.
OR
Remove do not allow null values constraint on the columns of the table you...
Try this.. for the variable @pmAction you need to specify the length of the varchar datatype unless it is single letter. You need to cast datetime,integer data types to varchar when storing a result in a string data type.
Hope this helps.
------------------------------------------------
CREATE...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.