Cursor in Sqlserver 2012

Hi Friends ,
I want to inquire  what is  the equivalent of following  in sqlserver  
for  x in (select a,b,c from  tableA) loop
insert tableB values(x.a,x.b,x.c);
end loop
thank you.
regards,
asad

Hi Mailkasad,
Did you get the result after run the statement as Visakh16 post above? If you want to copy all data from tableA to tableB, you can use the INSERT operation.
If there are any misunderstanding, please post more details. So we can help to work out the issue.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support

Similar Messages

  • SharePoint 2010 Excel Services with SQLserver 2012 cubes

    I have two tier sharepoint 2010 enterprise setup
    1)wfe  and app server
    2) sqlserver
    I also have a sqlserver 2012 which hosts all our BI cubes .
    is it possible to connect excel (office 2010)  to sql 2012 BI and save that in my sharepoint 2010 server  under shared documents and expect it to refresh when aall authenticated users hit " refresh all connections"
    It is not able to hit refresh . I get a " unable to refresh data for  a data connection in this notebook" the following connections fail to refresh.
    Interesting when I do the same this using sql server 2008 r2 BI , everything works fine

    Hi,
    According to your description, my understanding is that the SharePoint 2010 Excel Service cannot work with SQL Server 2012.
    Did you install Service Pack 1 for SharePoint 2010?
    SharePoint 2010 Service Pack 1 is required for SQL Server 2012 PowerPivot for SharePoint features.
    Please check if the Service Pack 1 is installed for SharePoint 2010. If not, please download it from the link below and install it:
    http://www.microsoft.com/en-hk/download/details.aspx?id=26623
    More references:
    http://msdn.microsoft.com/en-us/library/ee210708(v=sql.110).aspx
    http://msdn.microsoft.com/en-us/library/6d61be91-0396-443c-a7f4-02dcf973775e(v=sql.110)
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Invalid object name for Next value from sequence  using sqlserver 2012

    Select SequenceName.nextVal into lint from dual ;
    Invalid object name error message is coming when using sqlserver 2012
    Please help

    Hello,
    Create the sequence and a stored procedure which returns the sequence as follows:
    CREATE SEQUENCE mySequence_tinyint AS tinyint
    GO
    CREATE PROCEDURE Central_CreateSequence
       @NextID BIGINT OUTPUT
    AS
    BEGIN
       SET NOCOUNT ON;
       SELECT @NextID = NEXT VALUE FOR mySequence_tinyint;
    END
    GO
    In PowerBuilder, run this script:
    long ll = -10
    DECLARE proc PROCEDURE FOR Central_CreateSequence @NextID = :ll OUTPUT;      
    EXECUTE proc;
    FETCH proc INTO :ll;
    CLOSE proc;
    IF SQLCA.SQLcode <> 0 THEN
    MessageBox("error", SQLCA.sqlerrtext)
    END IF
    MessageBox("", ll)
    I know there can be other ways to return the next value of the sequence...
    HTH
    Jacob

  • Problem Copy big Table sqlserver 2012

    Hi Friends,
    Its 4th day I am trying to copy  table having 7 million record with text field  into same database (sqlserver 2012)  , but fail although I am using blade server with 256 Gb memory and multiprocessor. My query as followed
    select * into newtable from  maintable where flag=0 
    (Just while ago   I  canceled above statement (query) which was working since last 14 hours on server)
    Please help mean how I can copy.
    thank you.
    regards,
    asad
    asad

    Hi Friends,
    Its 4th day I am trying to copy  table having 7 million record with text field  into same database (sqlserver 2012)  , but fail although I am using blade server with 256 Gb memory and multiprocessor. My query as followed
    select * into newtable from  maintable where flag=0 
    (Just while ago   I  canceled above statement (query) which was working since last 14 hours on server)
    Please help mean how I can copy.
    Is the data going to change while you are running select. If it is not going to change and its history data and its just there for movement you can use NOLOCK hint like
    select * into newtable from maintable with (NOLOCK) where flag=0
    Please make sure
    NOLOCK query hint alos takes Schema stability lock and can be blocked if table from wher yo are selecting data is locked by alter table command. it also causes dirty reads and unexpected result so use at your own risk.
    You should consider methods suggested by Saeid
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Articles

  • GG for Sqlserver 2012

    Hi all,
    I want to replicate tables from Sqlserver 2012 to Oracle 11g. Is this version supported?
    Where can I find related docs for this activity?
    Thanks a lot,
    zxy

    Thanks Marie,
    Supposing I have a big table of Images/pictured LOB from Sqlserver( 1 million rows), and I want to migrate it to Oracle.
    I read in the docs that there is an "initial load" process in goldengate.  So does this mean GG can handle this bulk load of 1 millions lob images table?
    I just want to migrate the table. as another alternative/variation  just like doing expdp and impdp from oracle to oracle database, or extract to csv  and  sqlloading.
    (Since I can not do it with sqlserver-to-oracle)
    Thanks

  • IS THERE ANY WAY TO TRANSFER SQLSERVER 2012 DATABASE TO SQLSERVER 2005

    IS THERE ANY WAY TO TRANSFER  SQLSERVER  2012 DATABASE TO SQLSERVER 2005?
    Any Way?

    IS THERE ANY WAY TO TRANSFER  SQLSERVER  2012 DATABASE TO SQLSERVER 2005?
    Any Way?
    Hello,
    Please refer to the following article regarding how to downgrade SQL Server 2012 database to lower version:
    How to migrate a SQL Server database to a lower version:
    http://www.mssqltips.com/sqlservertip/2810/how-to-migrate-a-sql-server-database-to-a-lower-version/
    Regards,
    Elvis Long
    TechNet Community Support

  • SQLSERVER 2012 LOG BACKUP

    Hi Friends,
    I want to inquire, as our sqlserver 2012 in full  recovery mode , when ever we are taking backup using netbackup , the logfile size did not shrink or reduce. My question is what is default behavior of sqlserver 2012 after taking logfile backup the logfile
    size should reduce or not. As the logfile size keep increase which creating problem.
    thank you.
    regards,
    asad

    Please find below we experience suddenly extensive growth while rebuilding indexes and manually we shrink the log file.
    PROD
    102775.9922
    98.71157074
    1324.195956
    3/9/15 1:00 PM
    PROD
    248184
    99.48280334
    1283.599347
    3/9/15 2:00 PM
    PROD
    248184
    99.4907074
    1263.982753
    3/9/15 3:00 PM
    PROD
    104823.9922
    99.01555634
    1031.93315
    3/9/15 1:00 PM
    PROD
    248184
    99.62797546
    923.3053748
    3/9/15 4:00 PM
    PROD
    749.8046875
    4.465681076
    716.3208015
    3/8/15 11:00 AM
    PROD
    749.8046875
    5.280020714
    710.2148447
    3/10/15 8:00 AM
    PROD
    749.8046875
    6.103217125
    704.0424794
    3/11/15 10:00 AM
    PROD
    749.8046875
    7.214378834
    695.7109368
    3/9/15 6:00 PM
    PROD
    749.8046875
    8.520057678
    685.9208957
    3/8/15 12:00 PM
    PROD
    749.8046875
    9.84631443
    675.9765604
    3/8/15 1:00 PM
    PROD
    749.8046875
    9.94217205
    675.2578154
    3/8/15 2:00 PM
    PROD
    749.8046875
    10.02917385
    674.6054718
    3/10/15 6:00 PM
    PROD
    749.8046875
    10.04324055
    674.4999991
    3/8/15 3:00 PM
    PROD
    749.8046875
    10.60015583
    670.3242222
    3/8/15 4:00 PM
    PROD
    749.8046875
    13.66189098
    647.3671885
    3/8/15 5:00 PM
    PROD
    749.8046875
    13.92289639
    645.4101578
    3/10/15 11:00 PM
    PROD
    749.8046875
    14.33654594
    642.308594
    3/11/15 3:00 PM
    PROD
    749.8046875
    14.72414684
    639.4023443
    3/10/15 9:00 AM
    PROD
    749.8046875
    17.50924683
    618.5195341
    3/10/15 2:00 PM
    PROD
    749.8046875
    18.69497299
    609.6289037
    3/8/15 6:00 PM
    PROD
    749.8046875
    18.86376572
    608.3632879
    3/9/15 7:00 PM
    PROD
    749.8046875
    19.96249008
    600.1250011
    3/9/15 2:00 PM
    PROD
    749.8046875
    21.41690636
    589.2197197
    3/8/15 7:00 PM
    PROD
    749.8046875
    23.57749367
    573.0195348
    3/11/15 11:00 AM
    PROD
    749.8046875
    24.80978203
    563.7797789
    3/8/15 8:00 PM
    PROD
    749.8046875
    24.98254776
    562.4843733
    3/10/15 7:00 PM
    PROD
    749.8046875
    26.69236755
    549.6640644
    3/8/15 9:00 PM
    PROD
    749.8046875
    26.81687927
    548.7304697
    3/8/15 10:00 PM
    PROD
    749.8046875
    26.84032249
    548.5546913
    3/8/15 11:00 PM
    PROD
    749.8046875
    26.89606667
    548.1367189
    3/9/15 7:00 AM
    PROD
    749.8046875
    27.09090996
    546.6757747
    3/9/15 8:00 AM
    PROD
    749.8046875
    27.33628464
    544.8359439
    3/11/15 7:00 AM
    PROD
    749.8046875
    27.69386482
    542.1547909
    3/5/15 10:04 AM
    PROD
    749.8046875
    28.27455139
    537.8007758
    3/11/15 4:00 PM
    PROD
    749.8046875
    28.71086311
    534.5292901
    3/9/15 9:00 AM
    PROD
    749.8046875
    28.7757225
    534.0429713
    3/9/15 8:00 PM
    PROD
    749.8046875
    29.53060722
    528.3828103
    3/10/15 10:00 AM
    PROD
    749.8046875
    31.06902885
    516.8476528
    3/10/15 3:00 PM
    PROD
    749.8046875
    31.37275314
    514.5703138
    3/9/15 10:00 AM
    asad

  • Microsoft sqlserver 2012 License and Edition

    Folks,
    I am planning to use sqlserver 2012 Enterprise edition software and  i am in the process of procuring the
    per core License for the same.I would take 1 to 2 monts for quote ,discussions,License ,delivery of the product .
    Now i am in need to Install the sqlserver 2012 software urgently,and i am thinking of to download Evaluation Edition and once i received the Licensed product key i will upgrade to Enterprise edition.Does this
    a Valid Approach.
    If this is not ,please suggest how i can download and use the sqlserver 2012 Enterprise edition with AlwaysOn avaialbility Groups software.
    Thanks
    Surendra

    Hi,
    Yes it is possible to upgrade evaluation version to licensed version.
    Yes it is a valid approach too, but be aware that licensed version is valid upto 180 days.
    You may find the following articles useful.
    pgrade to a Different Edition of SQL Server 2012 (Setup)
    Upgrading from SQL Server 2012 Evaluation Edition
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page

  • SQLSERVER 2012 LOG SIZE INCREASE EXTENSIVELY

    Hi Friends,
    I want to inquire, as our sqlserver 2012 in full  recovery mode , I notices whenever we are executing rebuild indexes maintenancejob the logfile grown up extensively every time.  h
    thank you.
    regards,
    asad

    Hi Friends,
    I want to inquire, as our sqlserver 2012 in full  recovery mode , I notices whenever we are executing rebuild indexes maintenancejob the logfile grown up extensively every time.  h
    Asad,
    Why are you posting same thread about SQL Server log file every time. I can see all your previous threads on same Log file issue.
    This clearly shows that you don't spend event single moment reading links posted as answer. Why dont you go and read about SQL Server before asking *almost* same question every time.
    Yes log file will grow that is default behavior why are you executing index rebuild for all index. Did you searched about index rebuild and how it works and what gets logged.
    You can read here
    Curious case of logging in Online and offline index rebuild
    Use Ola Hallengren solution for index rebuild it will only rebuild index that is fragmented.
    Don't just blindly post question spend some time on net searching I am sure you would find lot of articles
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Cursor issue in 2012 v 2008r2

    Hi there,  we're executing the same stored procedure against identical databases on sql 2008r2 and 2012.
    The sp contains a cursor and runs quickly (3 mins) on 2008r2, yet continues to run on 2012.
    We've checked everything in terms of hardware, network, config and can't understand why.
    We've looked at the execution plan and it it is different.
    Is there any know issue with 2012 having issues with cursors?
    Many thanks
    P

    Can you also post the declaration of the cursor in the SP? Make sure to use options defined in this article
    http://bradsruminations.blogspot.com/2010/05/truth-about-cursors-part-1.html
    It could be that the defaults are different in your servers.
    Also, make sure that the compatibility level of your database matches the SQL Server version.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Unable to install the sqlserver 2012 in cluster services.

    Hi All, 
      Since couple of days i am tide with sql server 2012 cluster installation. Server account screen is moving hang state while providing the service account details (Domain\serviceaccount), Service account is a domain account and having local admin permission
    on both nodes. . 
      (04) 2014-10-10 18:09:01 SQLBrowser: This is a cluster-related scenario. IsCluster = 'True'.
    (04) 2014-10-10 18:09:01 SQLBrowser: CalculateStartMode: bIsNamedInstance = 'False', bIsDbmsEngineInstall = 'True', bEngineNetworkProtocolsOn = 'True', bIsAsInstall = 'False',bIsCluster = 'True'.
    (04) 2014-10-10 18:09:01 SQLBrowser: CalculateStartMode: Named instance needing SQL Server Browser: setting intended SQL Server Browser StartMode property to 'Automatic'.
    (04) 2014-10-10 18:09:01 SQLBrowser: EndMethod Type='SqlBrowserPublicConfig' Method='CalculateStartMode'.
    (04) 2014-10-10 18:09:01 SQLBrowser: EndMethod Type='SqlBrowserPublicConfig' Method='Calculate'.
    (04) 2014-10-10 18:09:01 SQLEngine: Use default collation: SQL_Latin1_General_CP1_CI_AS
    (04) 2014-10-10 18:09:01 SQLEngine: SqlEngine: Calculating default service account for engine service. Current value of SqlAccount:XXXX\XXXXXXX
    (04) 2014-10-10 18:09:01 SQLEngine: SqlEngine: Completed calculating default service account for engine service. Final value of SqlAccount:XXXX\XXXXXXX
    (04) 2014-10-10 18:09:01 Slp: Sco: Attempting to format the virtual account name from service name 'MSSQLFDLauncher'
    (04) 2014-10-10 18:09:01 SQLEngine: Use default collation: SQL_Latin1_General_CP1_CI_AS
    (04) 2014-10-10 18:09:01 SQLEngine: SqlEngine: Calculating default service account for engine service. Current value of SqlAccount: XXXX\XXXXXXX
    (04) 2014-10-10 18:09:01 SQLEngine: SqlEngine: Completed calculating default service account for engine service. Final value of SqlAccount: XXXX\XXXXXXX
    (04) 2014-10-10 18:09:01 Slp: Sco: Attempting to determine if the password is required for account 'XXXX\XXXXXXX'
    (04) 2014-10-10 18:09:01 Slp: Sco: Attempting to determine if the account XXXX\XXXXXXX is Virtual Account

    This is a known issue. Just use local account and setup domain accounts after the installation. See http://support.microsoft.com/kb/2913102
    Satish Kartan www.sqlfood.com

  • Migrate and Upgrade ReportServer database from SQLServer 2012 to SQLServer2014

    Hi,
    Today I migrated one reporting service from sql server 2012 to new server which running sql server 2014.
    Firstly I  back up encryption key and restored to new server, then follow the https://msdn.microsoft.com/en-AU/library/ms156421.aspx (e.g. backup, restore reportserver). In section "How to Configure the Report Server Database Connection" , I
    cannot pass this step as it complains it is not a report server, please see error below:
    However I can see my original reports/data srouces in below url and I can create new items like data source:
    http://sydwt-ssql-1/ReportServer
    http://sydwt-ssql-1/Reports/
    Anyone knows what happened?
    Here are the version information:
    - From
    Microsoft SQL Server 2012 (SP1) - 11.0.3412.0 (X64) 
    Mar  2 2014 01:25:09 
    Copyright (c) Microsoft Corporation
    Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: )
    - To
    Microsoft SQL Server 2014 - 12.0.2480.0 (X64) 
    Jan 28 2015 18:53:20 
    Copyright (c) Microsoft Corporation
    Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: )
    Thanks,
    Albert

    Hi
    As Alberto’s post, it's not supported to run a Windows Server Update Services (WSUS) database on SQL Server 2012 in Server 2008 R2. Since your application requires SQL Server 2012 Express as a minimum, you can try the following method:
    1. WSUS in Server 2012 supports SQL Server 2012, if you want to upgrade WSUS database supports SQL Server 2012, you need to upgrade WSUS 3.0 SP1, operation system and so on. For more information, you can post the question about WSUS in the
    Windows Server forums. It is appropriate and more experts will assist you. In addition, upgrade SQL Server 2005 to SQL Server 2012, as Shanky’s post, you need to make sure that your SQL Server 2005 has been applied Service Pack 4.
    2. However, if you don’t want to upgrade WSUS database from SQL Server 2005 to SQL Server 2012, I recommend you to install a new instance of SQL Server 2012 on Windows Server 2008 R2.
    In addition, before installing SQL Server 2012 or upgrading to SQL Server 2012, your system should meets the following prerequisites:
      • The Windows Installer service must be running.
      • Microsoft .NET Framework 3.5 SP1 and .NET Framework 4.0 are required.
      • Windows PowerShell 2.0 or later is required if you're upgrading the database engine.
    For more information about the prerequisites for installing SQL Server 2012, please review the following link:
    Hardware and Software Requirements for Installing SQL Server 2012:
    http://msdn.microsoft.com/en-us/library/ms143506(v=sql.110).aspx
    Thanks
    Lydia Zhang

  • What is the difference between licencing pricing list calls per user possessor per to buy a sqlserver 2012

    hi...................
                  i am junior system admin .In our company we want to buy a sqlserver.. i have a little bit confuse how can u buy 
    it depends on processor or user calls ..............PLEASE GIVE ME SUGGESTION ...........how to buy......i am expecting full description... Thanks in ADvance

    Thank u
    if i bought 5 calls means ? 
    1. i can use five times 
    2. i can apply to five users..
    which one is true 1 or 2

  • Running SSIS Using 32-Bit SQL Sqlserver 2012 implementation on a 64-Bit machine

    I created an SSIS job and I have installed 32-bit Sql Server, I use 32-bit MS Office Professional but my OS is 64-bit. The SSIS job wont run because the OLEDB connection gets errors because it's on this 64-bit machine. Can anyone assist n let me know how
    to configure?

    Hello,
    Please go through these helpful articles. I'm sure these would prove beneficial to you while running SQL Server Integration Services using 32-bit SQL Server 2012 implementation on a 64-bit environment.
    http://sqlblog.com/blogs/john_paul_cook/archive/2010/03/24/running-32-bit-ssis-in-a-64-bit-environment.aspx
    http://www.martinbour.com/code/post/Run-32-bit-SSIS-package-on-62-bit.aspx
    http://www.sqlhammer.com/blog/running-ssis-packages-in-32-bit/
    http://technet.microsoft.com/en-us/library/ms141766(v=sql.105).aspx
    If you find my post helpful please vote.
    Regards,
    Ankit Upadhyaya.

  • Sync Database without any latency using SQLSERVER 2012 R2

    Hi Team:
    With Regards, Santhosh Wilson

    There is always going to be a positive value for latency(time) between two servers A and B, whether they are next to one another in a rack in the data centre or in different geographic locations.
    What is the latency threshold for your requirements?
    Also, do you require bi-directional updates? If so then Replication is the only out of the box feature that will meet this need.
    John Sansom | SQL Server MCM
    Blog |
    Twitter | LinkedIn |
    SQL Consulting

Maybe you are looking for

  • Problems with image renderer

    I get somtimes following strange error message, when i use the <uix:image>-tag prepareAuxObj:java.io.StreamCorruptedException: Type code out of range, is 10 Has anybody an explanation for this? Marc

  • Transferring Information Thriller, PLEASE HELP!!!

    I'm transferring info from my G3 powerbook with OSX to my new drive on my powerbook G4 with OSX. I've gone through the welcome set up questions and selected to "transfer info from another computer". I'm doing it through the firewire "T" set-up. It st

  • Oracle VM server RAM question

    I am running two vm servers both with 16GB of physical memory installed. When I go in to check the memory specs for the servers using "free -m" or "cat /proc/meminfo" it only show a total of 577MB of RAM. Now I know this can not be true because curre

  • BW Landscape synchronization question

    Hi, Guru We have two BW DEV and QA systems in the system landscape: BWD & BWQ is the project phase1 (finance) D & Q system, respectively. BCD & BCQ is the phase2 (supply chain) D & Q system, respectively. Phase 1 and 2 share a single production syste

  • Keypressed in applet to browser

    Hi, i need to add a function to my applet. When user press F5 its usually to refresh the page, but when the focus is on the applet that didnt refresh the page cause its the applet that take the f5 key. So you need to click on the page (outside the ap