Thursday 15 September 2011

How to retrieve column name from the table and parse the results for each fieldname in sql 2012 -


How do I get the name of the table of the table on which I am selecting? I am trying to add results to the previous results for each field name.

Example (does not work):

  Announce @navarchar as concurrent (maximum) concat (separate parse (@ parcel, colonname (field 1 ), N ':' For some time, choose from field 1))   

some time:
  id, unit `------ --- `1, quart 2, gallon 3, liter   

result

id: 1, 2, 3 unit: quarters, gallon, liters

I am trying to do this in every field in my table that contains text, texture, four where the size is less than 4000, Use of the selection statement:

I am trying to parse the actual list of fields for my table (this works):

  Top 1000 SCHEMA_NAME ( [O] .checkma_id] [S] [name] [name], [c] .name [field name], [t] .name [type], [c] [name] as [schema name]. [S] [S] [s] as [l] [length], [c] .precision, [c] .scale, [c] sys.sysobjects [s] [s] internal association sys.all_columns as [s] .id = [C] .object_id internal [syn: System_type_id = [t]. Interactive sys.objects [s] at [o] .id = [o] .object_id where [s] .xtype such as 'U' and [t] .Name 'sysname%' and [ S] .name = N'TableName '  

In this way, I can clearly see the names of each field in which a different result is set.

If you know the list of files, then you can use something like this: Select the list1 union all as ORDER for some time by ID for SELECT (SELECT cast (id as varchar (50)), 'xml path (' ') (SEDE unit + ',' ORDER for some time 'by id for XML path (' ')) list2 ...

No comments:

Post a Comment