Forum Replies Created

Viewing 15 posts - 781 through 795 (of 1,114 total)

  • RE: Finding NULL count

    Can anybody help me to achieve the same task by using SET BASED THEORY ?

  • RE: Finding NULL count

    Hi All,

    Below one is working fine.

    --------------------------------------------------------

    declare @sql varchar(1000), @minid int, @maxid int,

    @table_n varchar(255), @col varchar(255), @dbnm varchar(50)

    Create table #tmp1

    (

    ID int identity(1,1),

    TableName varchar(50),

    ColumnName varchar(50)

    )

    Create table #FinalResult

    (

    DBName varchar(15),

    TableName varchar(50),

    ColumnName varchar(50),

    NULL_Row_Count int,

    Total int

    )...

  • RE: Finding NULL count

    EXEC sp_executesql

    @query = @sql,

    @params = N'@i INT OUTPUT',

    ...

  • RE: NULL & Count()

    declare @str varchar(2000)

    select @Nm = 'Age'

    select @str = 'select count(*) from #t1 where' +@Nm +' is null'

    exec (@str)

    am i correct ?

    If yes,How to capture the output in a variable.

  • RE: NULL & Count()

    Gila,

    Can you tell me how to do it ?

  • RE: While Loop Vs Cursor

    Sorry for my mistake.

    Please try it and let me know if there is any mistake.I hope i refined all the errors.

    -----------------

    CREATE PROCEDURE dbo.PAMA_UPD

    ...

  • RE: NULL & Count()

    Carl Federl

    select @Nm = 'Age'

    select @Null = count(*) from #t1 where (@Nm) is null

    As "where (@Nm) is null" will always be false, zero rows will meet the

    restriction.

    ...

  • RE: Finding NULL count

    My question is:

    How do I get the result of dynamic SQL into a variable?

  • RE: Finding NULL count

    Actually, It is working fine. But i want to capture the exec (@sql) & exec(@sql1) results in a seperate table.

  • RE: Finding NULL count

    No i am not getting any error message, But the results are not getting insert into that particluar table.

  • RE: While Loop Vs Cursor

    Can you tell me in which part you are getting error message ?

  • RE: Finding NULL count

    Ryan,

    Thanks for giving that URL.

    I have tried out the below code:

    ......................................................................................................................................

    --drop table #ColumnNames,#FinalResult

    Select ID = IDENTITY(1,1,int),name

    into #ColumnNames

    From syscolumns where object_name(id) = 'Stock'

    Declare @sql varchar(2000),@Sql1 varchar(2000)

    Declare @min-2 int,@Max int

    Declare @curColName...

  • RE: Finding NULL count

    Going further,

    I have morethan 120 tables in a DB. I have to pass each table one by one as a parameter and i need the mentioned output.

    As each and evry...

  • RE: Finding NULL count

    rbarryyoung,

    Thanks for your reply.

    But some table has more than 150 columns. So do i have to hard code it manually ? Is there any way to include the column name...

  • RE: While Loop Vs Cursor

    Jeff,

    Below is my code:

    ................................................

    CREATE PROCEDURE dbo.PAMA_UPD

    @dMonth DATETIME,

    @Pform VARCHAR(50)= '',

    @MId VARCHAR(50) = ''

    AS

    begin

    declare @StDt datetime

    declare @EndDt datetime

    declare @CheckDt datetime

    declare @totCnt integer

    declare @MStatus varchar(1)

    declare...

Viewing 15 posts - 781 through 795 (of 1,114 total)