hello All

I am having one table named loan_acc_configure in my database (SQL Server
2000)

the table contains only Y and N value in it.

Now i want the field name having value Y..

I made one Stored procedure using that i got filed names...

Now how would I know that they are of Y or N

the following code gives me the filed names of that table which having the
datatype char(1)

create table  #tmp_columns (COLUMN_NAME  varchar (70)  , DATA_TYPE  int ,
 TYPE_NAME   varchar (70) ,  data_precision int  , status char (1) )

declare @COLUMN_NAME  varchar (70)  , @DATA_TYPE  int ,  @TYPE_NAME
varchar (70) ,  @data_precision int
declare @sqlquery   nvarchar (1500)
declare @dec decimal (18)  , @int   int , @table_id  int


set  @table_id = 0
 /* Get Object ID */
SELECT @table_id = object_id(@table_name)

  insert into  #tmp_columns

SELECT
 COLUMN_NAME = convert(sysname,c.name),
 d.DATA_TYPE,
convert (sysname,case
when t.xusertype > 255 then t.name
 else d.TYPE_NAME collate database_default
end) TYPE_NAME,
convert(int,case
 when d.DATA_TYPE in (6,7) then d.data_precision /* FLOAT/REAL */
else OdbcPrec(c.xtype,c.length,c.xprec)
 end) ,
'N'
FROM
 sysobjects o,
master.dbo.spt_datatype_info d,
systypes t,
 syscolumns c

WHERE
 o.id = @table_id
AND c.id = o.id
 AND t.xtype = d.ss_dtype
AND c.length = isnull(d.fixlen, c.length)
AND (o.type not in ('P', 'FN', 'TF', 'IF') OR (o.type in ('TF', 'IF') and
c.number = 0))
 AND isnull(d.AUTO_INCREMENT,0) = isnull(ColumnProperty (c.id, c.name,
'IsIdentity'),0)
 AND c.xusertype = t.xusertype


delete from  #tmp_columns  where TYPE_NAME  <> 'char'




the result of the query is

column_name  DataType  Type Name Status
witness             1            char           N
witness_photo     1            char           N
wit_resshion_card  1            char           N
witness_service     1            char           N

now I want to update  status to Y from N if  the column_name  have value Y
in table
-- 
Rakesh Hendre,
Brilliance Software Systems.
Mob : 9960001862

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to