Click here to Skip to main content
15,891,708 members
Home / Discussions / Database
   

Database

 
GeneralRe: OmniDB - An Open Source Web Tool For Database Management and Conversion Pin
Rafael T. Castro29-Apr-16 9:34
Rafael T. Castro29-Apr-16 9:34 
Questioni want to create data base by using c++ language Pin
Member 1249285029-Apr-16 0:01
Member 1249285029-Apr-16 0:01 
AnswerRe: i want to create data base by using c++ language Pin
Eddy Vluggen29-Apr-16 0:26
professionalEddy Vluggen29-Apr-16 0:26 
AnswerRe: i want to create data base by using c++ language Pin
ZurdoDev29-Apr-16 8:09
professionalZurdoDev29-Apr-16 8:09 
QuestionChange Data Capture is not capturing before value for the Images Pin
indian14327-Apr-16 11:17
indian14327-Apr-16 11:17 
AnswerRe: Change Data Capture is not capturing before value for the Images Pin
Eddy Vluggen29-Apr-16 6:44
professionalEddy Vluggen29-Apr-16 6:44 
QuestionEnable-Migrations, I don't get it - EF6 Pin
jkirkerx23-Apr-16 13:36
professionaljkirkerx23-Apr-16 13:36 
QuestionImproving Performance of Dynamic Sql Pin
indian14319-Apr-16 12:25
indian14319-Apr-16 12:25 
Hi All,

I am using Dynamic SQL to load values from Audit tables into Flat-Table, for that I am taking all the tables and looping through their columns and inserting the values into Temp Table then I am putting the values from that Temp Table into a Flat Table.

Below is one of the insert into a temp Table, but like this there are 4 more Dynamic Sqls are there execute in that SP. But I saw these Dynamic Sqls are taking lot of time to execute. Can anybody please let me know if I can execute the Dynamic Sql as fast as normal SQL?

Any suggestion is appreciated. Thanks in advance I am also searching as well.
SET @sql =N'INSERT INTO #TrackUpdatedColumnNamesFlatTable_ForTemp (TableName, ColumnName, PrimaryKeyColumnName, PrimaryKeyValue, ChangeSetId
    , TransactionId, TransactionType, CreatedBy, ModifiedBy, CreatedDate, ModifiedDate, IsSoftDelete, IsCmsActive, ColumnValueAfter)
    select ''' + @TblName + ''', ''' +  @ColName + ''', ''' +  @PKColName + '''
    , CASE WHEN ' +  @PKColName + ' IS NULL THEN '''' ELSE ' +  @PKColName + ' END, ChangeSetId, $start_lsn, CASE WHEN ($operation=1) THEN ''Delete''
    WHEN $operation=2 THEN ''Insert''
    WHEN __$operation=4 THEN ''Update''
    END TransactionType, ' + @CreatedBy + ', '+ @ModifiedBy + ', '+ @CreatedDate + ', '+ @ModifiedDate + '
    , ' + CAST(@IsDeleted AS varchar(max)) + '
    , ' + CAST(@IsCmsActive AS varchar(max)) + '
    , CASE WHEN __$operation=1 THEN NULL ELSE CAST(' + @ColName + ' AS nvarchar(max)) END<br />
    FROM [cdc].' + @cdcinstancename
    + ' WHERE CAST(sys.fn_cdc_map_lsn_to_time($start_lsn) AS DATE)=CAST(''' + @DateToTrack + ''' AS DATE)
    AND sys.fn_cdc_is_bit_set(sys.fn_cdc_get_column_ordinal(''' + @captureinstance +
    ''',''' + '' + @ColName + '''), __$update_mask) = 1
    AND __$operation IN (1, 2, 4) OPTION(OPTIMIZE FOR UNKNOWN)';

    exec sp_executesql @sql, N'@IsColumnModified int out', @IsColumnModified out
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

SuggestionRe: Improving Performance of Dynamic Sql Pin
CHill6020-Apr-16 2:50
mveCHill6020-Apr-16 2:50 
GeneralRe: Improving Performance of Dynamic Sql Pin
indian14326-Apr-16 7:55
indian14326-Apr-16 7:55 
AnswerRe: Improving Performance of Dynamic Sql Pin
Oscar Salgado9-Aug-16 12:44
Oscar Salgado9-Aug-16 12:44 
QuestionImproving Performance of my SP which is looping using While Pin
indian14318-Apr-16 12:54
indian14318-Apr-16 12:54 
AnswerRe: Improving Performance of my SP which is looping using While Pin
Chris Quinn19-Apr-16 0:45
Chris Quinn19-Apr-16 0:45 
QuestionHow to sum consecutive in number of day Pin
hmanhha14-Apr-16 8:10
hmanhha14-Apr-16 8:10 
AnswerRe: How to sum consecutive in number of day Pin
Richard MacCutchan14-Apr-16 20:52
mveRichard MacCutchan14-Apr-16 20:52 
GeneralRe: How to sum consecutive in number of day Pin
hmanhha14-Apr-16 22:04
hmanhha14-Apr-16 22:04 
GeneralRe: How to sum consecutive in number of day Pin
Richard MacCutchan14-Apr-16 22:11
mveRichard MacCutchan14-Apr-16 22:11 
AnswerRe: How to sum consecutive in number of day Pin
John C Rayan15-Apr-16 4:47
professionalJohn C Rayan15-Apr-16 4:47 
QuestionReport is time out Pin
Member 1083678514-Apr-16 1:42
Member 1083678514-Apr-16 1:42 
AnswerRe: Report is time out Pin
Richard Deeming14-Apr-16 1:56
mveRichard Deeming14-Apr-16 1:56 
GeneralRe: Report is time out Pin
Member 1083678514-Apr-16 2:21
Member 1083678514-Apr-16 2:21 
GeneralRe: Report is time out Pin
Richard Deeming14-Apr-16 2:24
mveRichard Deeming14-Apr-16 2:24 
GeneralRe: Report is time out Pin
Member 1083678514-Apr-16 2:39
Member 1083678514-Apr-16 2:39 
GeneralRe: Report is time out Pin
Richard Deeming14-Apr-16 8:28
mveRichard Deeming14-Apr-16 8:28 
Questionhow to display record on screen Pin
Member 1245752113-Apr-16 17:08
Member 1245752113-Apr-16 17:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.