Loading ...
Sorry, an error occurred while loading the content.

problem with BCP syntax

Expand Messages
  • himanshu sinha
    Hi I am trying to BCP some data in the txt file But when i run the query below bcp SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname queryout
    Message 1 of 13 , Jun 2, 2005
    • 0 Attachment
      Hi I am trying to BCP some data in the txt file
       
      But when i run the query below
       
      bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname" queryout Authors.txt -c -ULogin -PPassword
       
      I am getting error as :
       
      Server: Msg 170, Level 15, State 1, Line 1
      Line 1: Incorrect syntax near 'queryout'.
      Please help
       
       


      sqlindia <sqlindia@...> wrote:
      Hi Praveen

      Thanx for your reply .. do you have any working module ..in caae so
      I can browse through.. this would help me to understand the nature
      of problem..

      regards



      --- In sqlcon@yahoogroups.com, "Praveen.V." <praveen_v_nair@y...>
      wrote:
      > Hi
      >
      >
      > You can have a inner join between
      source.information_schema.columns where table_name='X' and
      > target.information_schema.tables where table_name ='X'. If the
      total recordcount is less than the
      > number of fields there is a mismatch. Also this view contain the
      field specific details like
      > length , data_type etc. You put these also on join as a condition.
      >
      > Only thing is the columns should have the same name or should have
      the same ordinal position so
      > that the join is possible
      >
      >
      > Cheers
      >
      > Praveen v
      >
      >
      > --- sqlindia <sqlindia@y...> wrote:
      > > Hi Folks
      > >
      > > I have situation.. where I have to do
      > >
      > > - Validate Data from target Database against source Database
      > >   Structure before upgrade target database from source database.
      > >
      > > I would like have advise on it that what would be the ideal
      method
      > > OR
      > > how can i achieve this ??
      > >
      > >
      > > Thanx in advance
      > >
      > >
      > >
      > >
      > >
      > >
      >
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Tired of spam?  Yahoo! Mail has the best spam protection around
      > http://mail.yahoo.com







      SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
      http://www.mugh.net/sql

      Visit http://www.mugh.net/dnug to join .NET User Group.




      Regards,
      Himanshu Kumar Sinha

      MCP
      Microsoft Corporation
      Office: +91 (40) 5547 3617
      Mobile: +91 9440871180
      Email: v-hsinha@...

      Obstacles are those frightful things you see when you fail to focus on your goal


      Discover Yahoo!
      Have fun online with music videos, cool games, IM & more. Check it out!

    • mohan mareboina
      It is working fine at my desktop. Not able to repro the error. --Jagan
      Message 2 of 13 , Jun 2, 2005
      • 0 Attachment
        It is working fine at my desktop. Not able to repro
        the error.

        --Jagan


        --- himanshu sinha <kr_himanshu@...> wrote:

        > Hi I am trying to BCP some data in the txt file
        >
        > But when i run the query below
        >
        > bcp "SELECT au_fname, au_lname FROM pubs..authors
        > ORDER BY au_lname" queryout Authors.txt -c -ULogin
        > -PPassword
        >
        > I am getting error as :
        >
        > Server: Msg 170, Level 15, State 1, Line 1
        > Line 1: Incorrect syntax near 'queryout'.
        >
        > Please help
        >
        >
        >
        >
        > sqlindia <sqlindia@...> wrote:
        > Hi Praveen
        >
        > Thanx for your reply .. do you have any working
        > module ..in caae so
        > I can browse through.. this would help me to
        > understand the nature
        > of problem..
        >
        > regards
        >
        >
        >
        > --- In sqlcon@yahoogroups.com, "Praveen.V."
        > <praveen_v_nair@y...>
        > wrote:
        > > Hi
        > >
        > >
        > > You can have a inner join between
        > source.information_schema.columns where
        > table_name='X' and
        > > target.information_schema.tables where table_name
        > ='X'. If the
        > total recordcount is less than the
        > > number of fields there is a mismatch. Also this
        > view contain the
        > field specific details like
        > > length , data_type etc. You put these also on join
        > as a condition.
        > >
        > > Only thing is the columns should have the same
        > name or should have
        > the same ordinal position so
        > > that the join is possible
        > >
        > >
        > > Cheers
        > >
        > > Praveen v
        > >
        > >
        > > --- sqlindia <sqlindia@y...> wrote:
        > > > Hi Folks
        > > >
        > > > I have situation.. where I have to do
        > > >
        > > > - Validate Data from target Database against
        > source Database
        > > > Structure before upgrade target database from
        > source database.
        > > >
        > > > I would like have advise on it that what would
        > be the ideal
        > method
        > > > OR
        > > > how can i achieve this ??
        > > >
        > > >
        > > > Thanx in advance
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > >
        > >
        > >
        > > __________________________________________________
        > > Do You Yahoo!?
        > > Tired of spam? Yahoo! Mail has the best spam
        > protection around
        > > http://mail.yahoo.com
        >
        >
        >
        >
        >
        >
        >
        > SqlCon is a special interests group run under the
        > aegis of MUGH - http://www.mugh.net
        > http://www.mugh.net/sql
        >
        > Visit http://www.mugh.net/dnug to join .NET User
        > Group.
        >
        >
        >
        >
        > ---------------------------------
        > Yahoo! Groups Links
        >
        > To visit your group on the web, go to:
        > http://groups.yahoo.com/group/sqlcon/
        >
        > To unsubscribe from this group, send an email to:
        > sqlcon-unsubscribe@yahoogroups.com
        >
        > Your use of Yahoo! Groups is subject to the
        > Yahoo! Terms of Service.
        >
        >
        >
        > Regards,
        > Himanshu Kumar Sinha
        > MCP
        > Microsoft Corporation
        > Office: +91 (40) 5547 3617
        > Mobile: +91 9440871180
        > Email: v-hsinha@...
        >
        > Obstacles are those frightful things you see when
        > you fail to focus on your goal
        >
        >
        > ---------------------------------
        > Discover Yahoo!
        > Have fun online with music videos, cool games, IM &
        > more. Check it out!
      • mohan mareboina
        Hi All, One of my friends having folowing problem: Server A: OS: Win2k Advanced, SQL:2k (Ent) uses disk station. And right now running out of space. They
        Message 3 of 13 , Jun 3, 2005
        • 0 Attachment
          Hi All,

          One of my friends having folowing problem:

          Server A: OS: Win2k Advanced, SQL:2k (Ent) uses disk
          station. And right now running out of space.
          They brought SAN newly and some other serverB uses it.

          He wants to move some of the files to SAN by with out
          changing the existing architecture?

          Problem in oher words: Can he access database which is
          on A where as his files are on SAN which connected to
          server B?

          Please let me know any one has clue.

          Regards,
          Jacks
        • mohan mareboina
          Hi Friends, I have a surprise experience today would like to share with everyone of you for further help. I have an application role called MYWSAppRole . I
          Message 4 of 13 , Jun 3, 2005
          • 0 Attachment
            Hi Friends,

            I have a surprise experience today would like to share
            with everyone of you for further help.

            I have an application role called "MYWSAppRole". I
            want to add memebers to that using Query analyzer.
            Then I used following command:

            EXEC SP_ADDROLEMEMBER 'MYWSAppRole', 'Jacks'

            bombshell Result:

            Server: Msg 15014, Level 16, State 1, Procedure
            sp_addrolemember, Line 37
            The role 'MYWSAppRole' does not exist in the current
            database.

            But the role exists in database.

            select Name from sysusers where name ='MYWSAppRole'
            --------
            NovocainWSAppRole

            Please let me know how can I add the users to app role
            programatically?

            ( Note: I know how to add users using EM.)


            I am using SQL 2k

            Regards,
            Jacks
          • vijayasekar shanmughasundharaj
            hi u can try this by deleteing the particular Jacks from the Database where we have user details. ie sysusers or syslogin tables and again create the user
            Message 5 of 13 , Jun 4, 2005
            • 0 Attachment
              hi

              u can try this by deleteing the particular "Jacks" from the Database
              where we have user details. ie sysusers or syslogin tables and again
              create the user with that role.
              U can try this method in an test database and then u can move to your
              original database.incase any new ideas pls mail me too.

              bye

              with regards
              vijayasekar.s

              On 6/4/05, mohan mareboina <govinda_junior@...> wrote:
              > Hi Friends,
              >
              > I have a surprise experience today would like to share
              > with everyone of you for further help.
              >
              > I have an application role called "MYWSAppRole". I
              > want to add memebers to that using Query analyzer.
              > Then I used following command:
              >
              > EXEC SP_ADDROLEMEMBER 'MYWSAppRole', 'Jacks'
              >
              > bombshell Result:
              >
              > Server: Msg 15014, Level 16, State 1, Procedure
              > sp_addrolemember, Line 37
              > The role 'MYWSAppRole' does not exist in the current
              > database.
              >
              > But the role exists in database.
              >
              > select Name from sysusers where name ='MYWSAppRole'
              > --------
              > NovocainWSAppRole
              >
              > Please let me know how can I add the users to app role
              > programatically?
              >
              > ( Note: I know how to add users using EM.)
              >
              >
              > I am using SQL 2k
              >
              > Regards,
              > Jacks
              >
              >
              >
              >
              >
              >
              >
              >
              >
              > SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
              > http://www.mugh.net/sql
              >
              > Visit http://www.mugh.net/dnug to join .NET User Group.
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
              >
              >
              >
            • mohan mareboina
              Sorry for confusion, It is not possible to add users to approle Which is a special kind. I was even not able t add users to approle using EM. Please ignore
              Message 6 of 13 , Jun 4, 2005
              • 0 Attachment
                Sorry for confusion,

                It is not possible to add users to approle Which is a
                special kind. I was even not able t add users to
                approle using EM.

                Please ignore this mail.

                Regards,
                Jacks


                --- mohan mareboina <govinda_junior@...> wrote:

                > Hi Friends,
                >
                > I have a surprise experience today would like to
                > share
                > with everyone of you for further help.
                >
                > I have an application role called "MYWSAppRole". I
                > want to add memebers to that using Query analyzer.
                > Then I used following command:
                >
                > EXEC SP_ADDROLEMEMBER 'MYWSAppRole', 'Jacks'
                >
                > bombshell Result:
                >
                > Server: Msg 15014, Level 16, State 1, Procedure
                > sp_addrolemember, Line 37
                > The role 'MYWSAppRole' does not exist in the current
                > database.
                >
                > But the role exists in database.
                >
                > select Name from sysusers where name ='MYWSAppRole'
                > --------
                > NovocainWSAppRole
                >
                > Please let me know how can I add the users to app
                > role
                > programatically?
                >
                > ( Note: I know how to add users using EM.)
                >
                >
                > I am using SQL 2k
                >
                > Regards,
                > Jacks
                >
                >
                >
                >
                >
                >
                >
                >
              • skchandra_dba
                Hi Jacks, Application role has to be treated as different than SQL standard role . From BOL: Application roles do not have members; therefore, the user does
                Message 7 of 13 , Jun 4, 2005
                • 0 Attachment
                  Hi Jacks,

                  Application role has to be treated as different than 'SQL standard
                  role'.

                  From BOL:

                  Application roles do not have members; therefore, the user does not
                  have to be added to the application role.

                  When an application role is activated, the permissions usually
                  associated with the user's connection that activated the application
                  role are ignored. The user's connection gains the permissions
                  associated with the application role for the database in which the
                  application role is defined. The user's connection can gain access to
                  another database only through permissions granted to the guest user
                  account in that database. Therefore, if the guest user account does
                  not exist in a database, the connection cannot gain access to that
                  database.

                  After an application role is activated with sp_setapprole, the role
                  cannot be deactivated in the current database until the user
                  disconnects from SQL Server.

                  Also refer the following article for clear explanation
                  http://www.sqlteam.com/item.asp?ItemID=864

                  Thanks and regards,
                  SK Chandra

                  --- In sqlcon@yahoogroups.com, mohan mareboina <govinda_junior@y...>
                  wrote:
                  > Hi Friends,
                  >
                  > I have a surprise experience today would like to share
                  > with everyone of you for further help.
                  >
                  > I have an application role called "MYWSAppRole". I
                  > want to add memebers to that using Query analyzer.
                  > Then I used following command:
                  >
                  > EXEC SP_ADDROLEMEMBER 'MYWSAppRole', 'Jacks'
                  >
                  > bombshell Result:
                  >
                  > Server: Msg 15014, Level 16, State 1, Procedure
                  > sp_addrolemember, Line 37
                  > The role 'MYWSAppRole' does not exist in the current
                  > database.
                  >
                  > But the role exists in database.
                  >
                  > select Name from sysusers where name ='MYWSAppRole'
                  > --------
                  > NovocainWSAppRole
                  >
                  > Please let me know how can I add the users to app role
                  > programatically?
                  >
                  > ( Note: I know how to add users using EM.)
                  >
                  >
                  > I am using SQL 2k
                  >
                  > Regards,
                  > Jacks
                • sonny singh
                  Hi check this article out.. http://www.sqlteam.com/item.asp?ItemID=4722 http://www.sqlservercentral.com/scripts/contributions/27.asp
                  Message 8 of 13 , Jun 9, 2005
                  • 0 Attachment
                    Hi
                     
                    check this article out..
                     
                     
                     
                     
                    I think these scripts and example will be more than enough to solve your problem..
                     
                    good luck


                    himanshu sinha <kr_himanshu@...> wrote:
                    Hi I am trying to BCP some data in the txt file
                     
                    But when i run the query below
                     
                    bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname" queryout Authors.txt -c -ULogin -PPassword
                     
                    I am getting error as :
                     
                    Server: Msg 170, Level 15, State 1, Line 1
                    Line 1: Incorrect syntax near 'queryout'.
                    Please help
                     
                     


                    sqlindia <sqlindia@...> wrote:
                    Hi Praveen

                    Thanx for your reply .. do you have any working module ..in caae so
                    I can browse through.. this would help me to understand the nature
                    of problem..

                    regards



                    --- In sqlcon@yahoogroups.com, "Praveen.V." <praveen_v_nair@y...>
                    wrote:
                    > Hi
                    >
                    >
                    > You can have a inner join between
                    source.information_schema.columns where table_name='X' and
                    > target.information_schema.tables where table_name ='X'. If the
                    total recordcount is less than the
                    > number of fields there is a mismatch. Also this view contain the
                    field specific details like
                    > length , data_type etc. You put these also on join as a condition.
                    >
                    > Only thing is the columns should have the same name or should have
                    the same ordinal position so
                    > that the join is possible
                    >
                    >
                    > Cheers
                    >
                    > Praveen v
                    >
                    >
                    > --- sqlindia <sqlindia@y...> wrote:
                    > > Hi Folks
                    > >
                    > > I have situation.. where I have to do
                    > >
                    > > - Validate Data from target Database against source Database
                    > >   Structure before upgrade target database from source database.
                    > >
                    > > I would like have advise on it that what would be the ideal
                    method
                    > > OR
                    > > how can i achieve this ??
                    > >
                    > >
                    > > Thanx in advance
                    > >
                    > >
                    > >
                    > >
                    > >
                    > >
                    >
                    >
                    >
                    > __________________________________________________
                    > Do You Yahoo!?
                    > Tired of spam?  Yahoo! Mail has the best spam protection around
                    > http://mail.yahoo.com







                    SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
                    http://www.mugh.net/sql

                    Visit http://www.mugh.net/dnug to join .NET User Group.




                    Regards,
                    Himanshu Kumar Sinha

                    MCP
                    Microsoft Corporation
                    Office: +91 (40) 5547 3617
                    Mobile: +91 9440871180
                    Email: v-hsinha@...

                    Obstacles are those frightful things you see when you fail to focus on your goal


                    Discover Yahoo!
                    Have fun online with music videos, cool games, IM & more. Check it out!

                    SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
                    http://www.mugh.net/sql

                    Visit http://www.mugh.net/dnug to join .NET User Group.



                    How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos.
                    http://in.photos.yahoo.com

                  • Biswajit Das
                    You forgot mention the server name and database name himanshu sinha wrote: Hi I am trying to BCP some data in the txt file But when i
                    Message 9 of 13 , Jun 9, 2005
                    • 0 Attachment
                      You forgot mention the server name and database name
                       


                      himanshu sinha <kr_himanshu@...> wrote:
                      Hi I am trying to BCP some data in the txt file
                       
                      But when i run the query below
                       
                      bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname" queryout Authors.txt -c -ULogin -PPassword
                       
                      I am getting error as :
                       
                      Server: Msg 170, Level 15, State 1, Line 1
                      Line 1: Incorrect syntax near 'queryout'.
                      Please help
                       
                       


                      sqlindia <sqlindia@...> wrote:
                      Hi Praveen

                      Thanx for your reply .. do you have any working module ..in caae so
                      I can browse through.. this would help me to understand the nature
                      of problem..

                      regards



                      --- In sqlcon@yahoogroups.com, "Praveen.V." <praveen_v_nair@y...>
                      wrote:
                      > Hi
                      >
                      >
                      > You can have a inner join between
                      source.information_schema.columns where table_name='X' and
                      > target.information_schema.tables where table_name ='X'. If the
                      total recordcount is less than the
                      > number of fields there is a mismatch. Also this view contain the
                      field specific details like
                      > length , data_type etc. You put these also on join as a condition.
                      >
                      > Only thing is the columns should have the same name or should have
                      the same ordinal position so
                      > that the join is possible
                      >
                      >
                      > Cheers
                      >
                      > Praveen v
                      >
                      >
                      > --- sqlindia <sqlindia@y...> wrote:
                      > > Hi Folks
                      > >
                      > > I have situation.. where I have to do
                      > >
                      > > - Validate Data from target Database against source Database
                      > >   Structure before upgrade target database from source database.
                      > >
                      > > I would like have advise on it that what would be the ideal
                      method
                      > > OR
                      > > how can i achieve this ??
                      > >
                      > >
                      > > Thanx in advance
                      > >
                      > >
                      > >
                      > >
                      > >
                      > >
                      >
                      >
                      >
                      > __________________________________________________
                      > Do You Yahoo!?
                      > Tired of spam?  Yahoo! Mail has the best spam protection around
                      > http://mail.yahoo.com







                      SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
                      http://www.mugh.net/sql

                      Visit http://www.mugh.net/dnug to join .NET User Group.




                      Regards,
                      Himanshu Kumar Sinha

                      MCP
                      Microsoft Corporation
                      Office: +91 (40) 5547 3617
                      Mobile: +91 9440871180
                      Email: v-hsinha@...

                      Obstacles are those frightful things you see when you fail to focus on your goal


                      Discover Yahoo!
                      Have fun online with music videos, cool games, IM & more. Check it out!

                      SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
                      http://www.mugh.net/sql

                      Visit http://www.mugh.net/dnug to join .NET User Group.




                      Biswajit Das
                      System Analyst(05)
                      Microsoft.GDCI.FOIT.
                      V-bidas@...
                      Mobile-
                      09392472702
                      Office-
                      040-55931856

                      __________________________________________________
                      Do You Yahoo!?
                      Tired of spam? Yahoo! Mail has the best spam protection around
                      http://mail.yahoo.com

                    Your message has been successfully submitted and would be delivered to recipients shortly.