New answers tagged


Try the following query: I found this one working properly. This will select data in columns without identity = 1 DECLARE @Temp NVARCHAR(MAX); DECLARE @SQL NVARCHAR(MAX); SET @Temp = ''; SELECT @Temp = @Temp + COLUMN_NAME + ', ' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='Person' AND columnProperty(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') !...


This works much better: SELECT (SELECT CAST(CAST(( SELECT SUBSTRING(FieldToStrip, Number, 1) FROM master..spt_values WHERE Type='p' AND Number <= LEN(FieldToStrip) AND SUBSTRING(FieldToStrip, Number, 1) LIKE '[0-9]' FOR XML Path('')) AS xml) AS varchar(MAX))) FROM SourceTable

Top 50 recent answers are included