Update company set Tfn=null where tfn= '-2147483648 '
Update application set Companytfn=null where companytfn=-2147483648
UPDATE Company set Tfn=null where CAST (TFN as int) <0
UPDATE Application Set Companytfn=null WHERE companytfn<0
Select object_id from sys.columns where name like '%hin% '
SELECT * from Sys.tables where object_id in (select object_id from sys.columns where name like '%hin% ')
/////////////////////////////////////////////////////////////////////////////////////////////////
drop table #Tmp
CREATE TABLE #TMP
(
ID int IDENTITY (FIRST) NOT null--creates the column ID and adds 1 each time a new record is added
DeptID int,
Deptname varchar (50),
Datatimes datetime
Primary key (ID)--defines the primary key for the #tmp of the temporary table ID
);
Insert INTO #TMP Exec deptdisplay ' candied fruit ', 5
Select ID,
(Case DeptID "5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Deptid,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) as TT from #TMP
Declare @TempGroup table (ID int,deptname varchar (), datatimes datetime)
Insert INTO @TempGroup Exec deptdisplay ' candied fruit ', 5
Select ID,
(Case ID if ' 5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Id,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) from @TempGroup
UNION ALL
Select ID,
(Case ID if ' 5 ' Then ' HAHA '
When ' 4 ' Then ' NoNo '
Else ' Yeye '
End
) as Ids,
Id,deptname, (Select DATEADD (Q,1,isnull (datatimes, ' 1900-2-3 ')) from @TempGroup
SELECT DISTINCT * from @TempGroup
/////////////////////////////////////////////////////////////////////////////////////////////////
SQL Temp Table