Red Gate forums :: View topic - Comma has not been placed correctly as defined
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Refactor 1
SQL Refactor 1 forum

Comma has not been placed correctly as defined

Search in SQL Refactor 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
nghinv



Joined: 18 Nov 2009
Posts: 4

PostPosted: Thu Feb 25, 2010 5:07 am    Post subject: Comma has not been placed correctly as defined Reply with quote

Hi,

There is a problem with commas position when apply SQL layout.

I've configured to place commas at the beginning of source code lines but when I apply the format to the source code commas position for EXECUTE, FETCH INTO variables (CURSOR)... statements have not been applied correctly.

please investigate.

thanks & best regards,
Back to top
View user's profile Send private message
Anu Deshpande



Joined: 20 Apr 2009
Posts: 685
Location: Cambridge

PostPosted: Fri Feb 26, 2010 10:48 am    Post subject: Reply with quote

Many thanks for your post.

Can you kindly let us know steps to reproduce the problem will be really helpful?
_________________
Anuradha Deshpande
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
nghinv



Joined: 18 Nov 2009
Posts: 4

PostPosted: Sat Feb 27, 2010 5:51 am    Post subject: Reply with quote

1. In SQL Refactor options, set the following item:
(Setting 1) SET Place Comma At Start
(Setting 2) SET [Column Placement] = [On New Line]
2. Apply the SQL layout for the following code

Code:


IF EXISTS ( SELECT
                *
            FROM
                sysobjects
            WHERE
                name = 'STP_ABC' )
    DROP PROC STP_ABC
GO
CREATE PROC STP_ABC
(
  @param1 VARCHAR(50)
, @param2 VARCHAR(50)
, @param3 VARCHAR(50)
, @param4 VARCHAR(50)
, @param5 VARCHAR(50)
, @param6 VARCHAR(50)
, @param7 VARCHAR(50)
, @param8 VARCHAR(50)
, @param9 VARCHAR(50)
, @param10 VARCHAR(50)
, @param11 VARCHAR(50)
, @param12 VARCHAR(50)
, @param13 VARCHAR(50)
, @param14 VARCHAR(50)
, @param15 VARCHAR(50)
, @param16 VARCHAR(50)
, @param17 VARCHAR(50)
, @param18 VARCHAR(50)
, @param19 VARCHAR(50)
, @param110 VARCHAR(50)
)
AS
BEGIN
    CREATE TABLE #test
    (
      col1 VARCHAR(50)
    , col2 VARCHAR(50)
    , col3 VARCHAR(50)
    , col4 VARCHAR(50)
    , col5 VARCHAR(50)
    , col6 VARCHAR(50)
    , col7 VARCHAR(50)
    , col8 VARCHAR(50)
    , col9 VARCHAR(50)
    , col10 VARCHAR(50)
    , col11 VARCHAR(50)
    , col12 VARCHAR(50)
    , col13 VARCHAR(50)
    , col14 VARCHAR(50)
    , col15 VARCHAR(50)
    , col16 VARCHAR(50)
    , col17 VARCHAR(50)
    , col18 VARCHAR(50)
    , col19 VARCHAR(50)
    , col110 VARCHAR(50)
    )
    DECLARE CS CURSOR
        FOR SELECT TOP 10
                *
            FROM
                #test
    OPEN CS
    FETCH NEXT FROM CS INTO @param1, @param2, @param3, @param4, @param5,
        @param6, @param7, @param8, @param9, @param10, @param11, @param12,
        @param13, @param14, @param15, @param16, @param17, @param18, @param19,
        @param110

    select
        @param1
      , @param2
      , @param3
      , @param4
      , @param5
      , @param6
      , @param7
      , @param8
      , @param9
      , @param10
      , @param11
      , @param12
      , @param13
      , @param14
      , @param15
      , @param16
      , @param17
      , @param18
      , @param19
      , @param110
    close CS
    Deallocate CS
    DROP TABLE #test
   
END

Go

DECLARE
    @param1 VARCHAR(50)
  , @param2 VARCHAR(50)
  , @param3 VARCHAR(50)
  , @param4 VARCHAR(50)
  , @param5 VARCHAR(50)
  , @param6 VARCHAR(50)
  , @param7 VARCHAR(50)
  , @param8 VARCHAR(50)
  , @param9 VARCHAR(50)
  , @param10 VARCHAR(50)
  , @param11 VARCHAR(50)
  , @param12 VARCHAR(50)
  , @param13 VARCHAR(50)
  , @param14 VARCHAR(50)
  , @param15 VARCHAR(50)
  , @param16 VARCHAR(50)
  , @param17 VARCHAR(50)
  , @param18 VARCHAR(50)
  , @param19 VARCHAR(50)
  , @param110 VARCHAR(50)

EXEC STP_ABC @param1, @param2, @param3, @param4, @param5, @param6, @param7,
    @param8, @param9, @param10, @param11, @param12, @param13, @param14,
    @param15, @param16, @param17, @param18, @param19, @param110


3. You can see that commas have not been placed correctly as expected (Seting 1 and Seting 2)

Code:
FETCH NEXT FROM CS INTO @param1, @param2, @param3, @param4, @param5,
        @param6, @param7, @param8, @param9, @param10, @param11, @param12,
        @param13, @param14, @param15, @param16, @param17, @param18, @param19,
        @param110

and
Code:
EXEC STP_ABC @param1, @param2, @param3, @param4, @param5, @param6, @param7,
    @param8, @param9, @param10, @param11, @param12, @param13, @param14,
    @param15, @param16, @param17, @param18, @param19, @param110


-- thanks
Back to top
View user's profile Send private message
Anu Deshpande



Joined: 20 Apr 2009
Posts: 685
Location: Cambridge

PostPosted: Tue Mar 02, 2010 12:53 pm    Post subject: Reply with quote

Many thanks for your detailed explanation I have added this (Setting to be provided for formatting Exec statements and cursors ) as a feature request in our internal tracking system.

Tracking Id for this is SR-876.

It will be reviewed for a future release of SQL Refactor although we have no timescales for this at present.

Kindly let us know if you have any other issues or questions regarding the product,I'll like to help.
_________________
Anuradha Deshpande
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group