Viewing 15 posts - 1,186 through 1,200 (of 2,007 total)
prashant-507002 (12/9/2011)
Please try to understand As per your query i have to modify query each when user added new fieldName
No you don't.
Read what I wrote again, it uses dynamic SQL...
December 9, 2011 at 6:57 am
prashant-507002 (12/9/2011)
This is vertically data storageI can not put the hard code fieldname bcz user can add more field name in it.
BEGIN TRAN
SELECT Id, FieldName, FieldValue, RecordID
INTO #temp
FROM (SELECT 1,...
December 9, 2011 at 6:53 am
prashant-507002 (12/9/2011)
I have run the update query in ssms without doing begin transaction.Are there any way to rollback the updated data?
Hope it wasn't a production database.
December 9, 2011 at 6:35 am
I don't like that there is no ID to show where 1 record ends and another begins, but try this
BEGIN TRAN
SELECT Id, FieldName, FieldValue
INTO #temp
FROM (SELECT 1, 'Name', 'John...
December 9, 2011 at 6:32 am
BEGIN TRAN
SET NOCOUNT ON
--Create sample data to play with
SELECT name, col1, col2
INTO #yourTable
FROM (SELECT 'mary', 'id222', 'a'
UNION ALL SELECT 'mary', 'id222', 'b'
...
December 9, 2011 at 6:23 am
Here's a 1 million row attempt to reproduce what you're describing.
BEGIN TRAN
SET NOCOUNT ON
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN
DROP TABLE #testEnvironment
END
--1,000,000 Random rows of data
SELECT TOP 1000000 IDENTITY(INT,1,1) AS ID,
(ABS(CHECKSUM(NEWID()))...
December 9, 2011 at 6:13 am
December 9, 2011 at 5:19 am
1. 18,000 is not a "huge data".
2. The query you were given works fine
3. Your database design is awful and will cause performance problems as your data-set increases.
BEGIN TRAN
SET NOCOUNT...
December 9, 2011 at 5:06 am
Feeling a bit kind.
I've left a deliberate flaw in the design for you to work out.
BEGIN TRAN
CREATE TABLE #breaks (
breakID INT IDENTITY PRIMARY KEY,
breakTimeFrom TIME,
breakTimeTo TIME)
INSERT INTO #breaks
SELECT breakTimeFrom, breakTimeTo
FROM...
December 9, 2011 at 4:27 am
Evil Kraig F (12/9/2011)
Koen Verbeeck (12/9/2011)
Cadavre (12/9/2011)
Koen Verbeeck (12/9/2011)
December 9, 2011 at 2:56 am
Koen Verbeeck (12/9/2011)
Cadavre (12/9/2011)
Koen Verbeeck (12/9/2011)
So...
December 9, 2011 at 2:27 am
Why? What do you think is wrong with DISTINCT?
SELECT role_name, mbr_id, start_dt, end_dt
FROM (SELECT ixo_rlt_code AS role_name, ind_membership_id_ext AS mbr_id, ixo_start_date AS start_dt, ixo_end_date AS end_dt
...
December 9, 2011 at 2:22 am
Koen Verbeeck (12/9/2011)
So now I have...
December 9, 2011 at 2:10 am
Ellen-477471 (12/8/2011)
December 8, 2011 at 9:39 am
SQLRNNR (12/8/2011)
Yay. Now I know for sure that there are only 17 days until Christmas.
And knowing is half the battle.
/@
\ ...
December 8, 2011 at 9:25 am
Viewing 15 posts - 1,186 through 1,200 (of 2,007 total)