Help need in Avoiding Loop

Hi,
My table and data:
Create table Sample(Empid int primary key identity(1,1),EmpName varchar(50),Empsalary money,EmpDesignation varchar(30));
insert into Sample values('Jhon',8000,'Manager'),
('Smith',6000,'Lead'),
('Samuel',4000,'AccountExecutive'),
('Simson',4000,'AccountSpecialist'),
('Eric',22000,'Director'),
('Jonathan',12000,'SeniorManager')
Expected Result
select 'EmpName','Jhon','Smith','Samuel','Simson','Eric','Jonathan' union all
select 'Salary','8000','6000','4000','4000','22000','12000' union all
select 'Designation','Manager','Lead','AccountExecutive','AccountSpecialist','Director','SeniorManager'
Is it possible to do without using loop? can anyone please give me some sample query to achieve. Also 
I have 2k * 1000 reocords in my table. Is it possible to bring the data based on by passing the page size.
Thanks in Advance
loving dotnet

I got the same error. Apparently 10K is the internal maximum and you can not go beyond that (I didn't try to find the exact limit). I slightly changed the query:
IF OBJECT_ID('TempDB..#Sample', N'U') IS NOT NULL
DROP TABLE #Sample
CREATE TABLE #Sample (
Empid INT PRIMARY KEY identity(1, 1)
,EmpName VARCHAR(50)
,Empsalary MONEY
,EmpDesignation VARCHAR(30)
INSERT INTO #Sample
VALUES (
'Jhon1'
,8000
,'Manager'
'Smith2'
,6000
,'Lead'
'Samuel3'
,4000
,'AccountExecutive'
'Simson4'
,4000
,'AccountSpecialist'
'Eric5'
,22000
,'Director'
'Jonathan6'
,12000
,'SeniorManager'
) -- 6 rows
INSERT INTO #Sample (
EmpName
,Empsalary
,EmpDesignation
SELECT EmpName = a.EmpName + CAST(ROW_NUMBER() OVER (
ORDER BY f.Empid
,e.Empid
,d.Empid
,c.Empid
,b.Empid
,a.empid
) AS VARCHAR(5))
,a.Empsalary
,a.EmpDesignation
FROM #Sample a
,#Sample b
,#Sample c
,#Sample d
,#Sample e
,#Sample f
-- 46662 rows
DECLARE @Statement NVARCHAR(MAX)
,@StartRn INT = 1
,@EndRn INT = 15000
,@Cols NVARCHAR(max)
,@Loop INT
,@ColsDescr NVARCHAR(max)
--SET @Loop = 0
--WHILE (@Loop + @StartRn) <= @EndRn
--BEGIN
-- SET @Cols = coalesce(@Cols + ', ', '') + '[' + cast(@Loop + @StartRn AS NVARCHAR(max)) + ']'
-- SET @ColsDescr = coalesce(@ColsDescr + ', ', '') + '[' + cast(@Loop + @StartRn AS NVARCHAR(max)) + '] AS [' + cast(@Loop + 1 AS NVARCHAR(max)) + ']'
-- SET @Loop = @Loop + 1;
--END
select @Cols = stuff((select ', ' + quotename(convert(varchar(10), number)) from dbo.Numbers
where number between @StartRn and @EndRn
order by Number
for xml path('')), 1,2, '')
SET @Statement = ';with CTE AS (SELECT
Val,
Cat,
Rn = ROW_NUMBER() OVER (PARTITION BY Cat ORDER BY Empid )
FROM (
SELECT
Empid,
Empname,
EmpSalary = CAST(Empsalary as varchar(50)),
Empdesignation = CAST(Empdesignation as varchar(50))
FROM #Sample
)s
unpivot (
Val FOR Cat IN (EmpName, EmpSalary, EmpDesignation)
)unpvt)
SELECT *
FROM
(SELECT * FROM cte
WHERE Rn BETWEEN @StartRn AND @EndRn ) Src
PIVOT(
MAX(Val) FOR Rn IN (' + @Cols + ')
)p
PRINT @Statement
EXECUTE sp_ExecuteSQL @Statement
,N'@StartRn INT, @EndRn INT'
,@StartRn = @StartRn
,@EndRn = @EndRn
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Help needed with while loops please :)

    I'm beginning to study java at School.
    My assignment using while loops, to ask user to input 2 numbers.
    I have to output all odd number between the two.
    I have to output the sum of all even numbers between the two.
    Output all the numbers and their squares between 1-10.
    Output the squares of the odd numbers between the 2 numbers the user entered.
    Output all uppercase letters.
    If anyone can give me any help, I would appreciate it greatly.
    Thank you.
    Kelly.

    It would help if you put aside your code, and wrote out some pseudo-code first so that you understand the steps you will need to take. for example
    get input from user
    set counter to first number entered
    while counter less than/ equal to second number
          check if number is even
               if even, add to even_sum
               else output counter, along with its square
          increment counter by one
    end while
    output sum of evensthat block, when coded, will solve 3 of the problems, the other 2 will require separate loops
    Good Luck

  • Help needed with 'while' loop please

    Problem: When a non-integer is entered, the console displays "Enter a wager > java.util.InputMismatchException" intermitentlly.
    Here is the source codes
    ===================
    import java.util.Scanner;
    public class Test {
         private static int bankBalance = 1000;
         public static void main(String []args) {
              System.out.println("You entered: " + wager());
          Ask user for a wager, which must not be greater than 'bankBalance' and
          must be a valid Integer. Continue asking until a valid wager is entered.
         private static int wager() {
              Scanner scanner = new Scanner(System.in);
              int input = bankBalance + 1;
              boolean isValid = false;
              while( (input > 1000) || (isValid == false) ) {
                   try {
                        System.out.print("Enter a wager > ");
                        input = scanner.nextInt();
                        isValid = true;
                   } catch(java.util.InputMismatchException im_exc) {
                        System.out.println(im_exc.toString());
              return input;
    }

    It would help if you put aside your code, and wrote out some pseudo-code first so that you understand the steps you will need to take. for example
    get input from user
    set counter to first number entered
    while counter less than/ equal to second number
          check if number is even
               if even, add to even_sum
               else output counter, along with its square
          increment counter by one
    end while
    output sum of evensthat block, when coded, will solve 3 of the problems, the other 2 will require separate loops
    Good Luck

  • Help needed with optimising loops

    hello again,
    am wondering if there're any suggestions to help optimise my code. i'm having a mindblock now. i need to retrieve the top 10 occurring elements in my array. attached is my code.
    it's taking much to long... i'm nesting a loop of 40,000+(original file contents) in a loop of 1,000+(non-repeating items of the original file contents) in a loop of 10. i can't think of how else to do it. any suggestions?
               //get top 10 most frequently visited hosts
               //start by tabulating hits for each website, using non-repeated items
               //add the top to the 1st arraylist slow, until we get 10 items
               String championSite = "";
               String currentSite = "";
               int championCount = 0;
               int currentCount = 0;
               int bufferCount = 0;
               String bufferSite = "";
               StringTokenizer st;
               ArrayList hitCounter = new ArrayList();
               boolean removed = false;
               for(int extLoop=0;extLoop<10;extLoop++)
                    for(int i=0;i<nonRepeatedItems.size();i++)
                         bufferCount = 0;
                         //currentSite = String.valueOf(nonRepeatedItems.get(i));
                         for(int count=0;count<parsedContents.size();count++)
                              System.out.println(count);
                              st = new StringTokenizer(String.valueOf(parsedContents.get(count)));
                              for(int random=0;random<6;random++)
                                   st.nextToken();
                              bufferSite = st.nextToken(); //get the website column
                              //get address without path information, index 7 because "HTTP://"
                              bufferSite = bufferSite.substring(0,(bufferSite.indexOf("/",7)));
                              if(String.valueOf(nonRepeatedItems.get(i)).equalsIgnoreCase(bufferSite))
                                   bufferCount++;
                                   //delete the current pointer in parsedContents
                                   //maintain the pointer count?
                         //store the first
                         if(i==0)
                              currentCount = bufferCount;
                              currentSite = String.valueOf(nonRepeatedItems.get(i));
                              championCount = currentCount;
                              championSite = currentSite;
                         else
                              //store only if greater than existing value
                              if(bufferCount>currentCount)
                                   currentCount = bufferCount;
                                   currentSite = String.valueOf(nonRepeatedItems.get(i));
                                   championCount = currentCount;
                                   championSite = currentSite;                                    
                    //top10webSites.add(championSite+" "+championCount);
                    if(championCount!=0)
                         System.out.println(extLoop+1+". "+championSite+" with "+championCount+" visits.");
                    championSite = "";
                    championCount = 0;
                    //remove the current topsite from the original list
                    for(int i=0;i<nonRepeatedItems.size();i++)
                         if(String.valueOf(nonRepeatedItems.get(i)).equalsIgnoreCase(currentSite))
                              nonRepeatedItems.remove(i);
                              break;
               }

    Knowing the forums today, there's really probably like 10 responses already though I see none.
    The best way would likely be to use a HashMap to keep track of the occurances of each item. Example:
    List<String> stringList = new ArrayList<String>(); //with tons of items
    Map<String, Integer> tally = new HashMap<String,Integer();
    for ( String item : stringList ) {
      if ( tally.containsKey(item) ) {
        tally.put( item, tally.get(item)+1 );
      else
         tally.put( item, 1);
    //then loop through each entry in tally.entrySet() to find out which has most entries
    edit Surprise, surprise.
    Edited by: endasil on Nov 30, 2007 3:05 PM

  • Package Help needed For each Loop container

    Hello all,
    I need a bit of advice, I`m a newbee to SSIS so I`m learning. Here`s what I need. I have a EDI 837 file which needs to be converted and inserted into a sql table. These are multiple files and I need to maintain them with a monthly load. So I have a source
    folder where these files will be dumped. I created a Package which will grab the files process the EDI aspect inserts into the data into table. This is the story on a high level.
    Here`s what I did.
    Created a For each loop container.
    I have a stored proc which takes in a 837 files and gets the fields what I want and it inserts it into a staging table from there I have a data flow task which pipes it into my production table.
    Inside the loop first task is to exec the Stored Proc but my question is once a file is picked up from for each loop I need the file to be inserted into a table which I am referencing in my store proc. All the EDI conversion takes place in my SP and it references
    the table..
    My question is the For each loop container picks up the files but where does the data goes?? Can someone help me out
    FM

    The foreach loop container (file enumerator) only returns the filename or filepath which you can use as a parameter in an Execute SQL Task or within an expression on a connection manager (which can be used in a Data Flow). So it doesn't do anything with
    the file. You have to add a task within the loop to do something with the file (Execute SQL Task/Data Flow Task/File System Task/etc.).
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • US Verizon iPhone 4 - visiting Japan help needed to avoid roaming

    hi
    I've got an original Verizon iPhone 4 running iOS 5 and will be going to Japan. I want to avoid roaming charges but I would like to be able to use my apps on wifi.
    After talking to Verizon, it sounds like if I break down and update to iOS 7, then I can put my phone on "Do not Disturb" and I won't get calls or texts, but can use wifi.
    Does this sound right? Or should I just plan to turn my phone off before leaving the US and turn it back on only upon my return?
    Thanks

    No you CAN'T use that AT&T sim card for a Verizon phone.
    You have a Verizon iPhone 4, which is a CDMA phone only and does NOT come with a sim card tray.  It was the Verizon iPhone 4s and above that came with the sim card tray to be used for international travel only.  There is nowhere for you put a sim card in a Verizon iPhone 4, so you can't do that.
    If you want to be able to do that and use local sim cards, then you will have to buy a new Verizon phone such as an iPhone 5s that comes with a sim card tray that is unlocked for international use, but you CANNOT use it in a Verizon iPhone 4 because there is no sim card tray.

  • Need help on a while loop

    Hi...I am somewhat new to Java and I am trying to do a nested while loop. Basically I have a result set from a query and I want to loop though that result set BUT I need a second loop to put together 150 of the results at a time and add them to a GeoCodeRequest to send to MapInfo.....this is how I think the code should look, I need some advice if it is the proper way to loop through....
    ArrayList aal = new ArrayList();
    ServiceMessage sm = new ServiceMessage();
    ServiceMessage rsm = new ServiceMessage();
    while (rset.next())
    statRecord = statRecord + currentRecord;
    while (rset.next() && currentRecord <= 150)
    AddressEx a = new AddressEx(rset.getString(6));
    ContentColumn cc = new ContentColumn("mmhid");
    cc.setValue(rset.getString(1));
    StreetAddress streetAddress = new StreetAddress(rset.getString(3));
    streetAddress.setBuildingName(rset.getString(2));
    a.setCountrySubdivision(rset.getString(5));
    a.setMunicipality(rset.getString(4));
    a.setPostalCode(rset.getString(6));
    a.setContentColumn(0,cc);
    aal.add(a);
    currentRecord++;
    System.out.println("Inside inner while loop now..");
    System.out.println("Add 150 to request...");
    GeocodeRequestEx gr = new GeocodeRequestEx("","3.0","id",(AddressEx[])aal.toArray());
    gr.setGeocodePreference(pref);
    sm.addRequest(gr);
    System.out.println("going to geocode now...");
    try{
    LocationUtilityServiceLocator lus = new LocationUtilityServiceLocator();
    LocationUtility lu = lus.getLocationUtility(new URL(url));
    XLSType xr = lu.perform(sm.toXLS());
    rsm = new ServiceMessage(xr);......
    code goes on to do oter things but this is the basis..............
    I hope that all made since.....please help.

    I am not sure if there is a problem, that is what I am
    asking......if I have the logic correct.
    I haven't been able to test it correct because I am
    getting an:
    Exception in thread "main"
    java.lang.ClassCastException: [Ljava.lang.Object; at
    geoClient.main(geoClient.java:127)
    That means you don't have it correct.  :-)> on the following line:> > GeocodeRequestEx gr = new> GeocodeRequestEx("","3.0","id",(AddressEx[)aal.toArray
    and I haven't figured out to correct that yet......You need to use toArray(Object[]).

  • Help needed in making a Recursive loop( loops into loops)

    Hi i have a situation, i need to make loop into loop into loop....undecided loop.
    i have a object list which are parent.........eg.
    i query to get my 1st list is A, B and C....i loop it to display in table
    while looping i query A to get its child AA, AB, and AC, i loop it in table..
    while looping i query AA to get its child AAA, AAB and AAC...
    i have to check for the child till it has child level donw level...but i dont know how can i make a dynamic loop...i cant write a loop it for 15 to 20 .
    Is there any way to make a recursive loop so tht it checks for child into child.
    thanks

    my code is such......
    Corres[] objCorresBean = correspondence.getCorrespondence(objectId);
    for (int i = 0; i < objCorresBean.length; i++) {
    CorrespondenceBean corresBean = objCorresBean;
    String parent_object_id = corresBean.getObjectId();
    childCorresBean = correspondence.getChildCorrespondence
    (parent_object_id);
    for (int j = 0; j < childCorresBean.length; j++) {
    CorrespondenceBean childBean = childCorresBean[j];
    String child_object_id = childBean.getChildObjectId();
    may be child_object_id have some childrens.......i want to make it recursive

  • Help needed for grouping.

    Hi,
        Help needed .
    I have an internal table having 6 .
    Ex :
    f1     f2    f3     f4    f5    f6
    a     aa    11    p1  10    10
    a     aa    12    p1  20    20
    b     aa    11    p2  30    30
    b     aa    12    p2  40    30
    Now i want to sum the fields f5 and f6 individually and need to display based upon the fields f1 and f4.
    To Display :
    f1     f2    f3     f4    f5    f6
    a     aa    11    p1  30    30.
    b     aa    11    p2  70    60.
    can anyone help me.How to do this..?
    Thanks

    Here you go
    DATA:
      BEGIN OF cur_tab OCCURS 0,
        f1        TYPE c,
        f2(2)     TYPE c,
        f3(2)     TYPE c,
        f4(2)     TYPE c,
        f5(2)     TYPE c,
        f6(2)     TYPE n,
      END OF cur_tab.
    DATA:
      BEGIN OF sum_tab OCCURS 0,
        f1        TYPE c,
        f4(2)     TYPE c,
        f5        TYPE p,
        f6        TYPE p,
      END OF sum_tab.
    DATA:
      BEGIN OF final_tab OCCURS 0,
        f1        TYPE c,
        f2(2)     TYPE c,
        f3(2)     TYPE c,
        f4(2)     TYPE c,
        f5(5)     TYPE c,
        f6(5)     TYPE c,
      END OF final_tab.
    START-OF-SELECTION.
      cur_tab-f1 = 'a'.
      cur_tab-f2 = 'aa'.
      cur_tab-f3 = '11'.
      cur_tab-f4 = 'p1'.
      cur_tab-f5 = '10'.
      cur_tab-f6 = '10'.
      APPEND cur_tab.
      cur_tab-f1 = 'a'.
      cur_tab-f2 = 'aa'.
      cur_tab-f3 = '11'.
      cur_tab-f4 = 'p1'.
      cur_tab-f5 = '20'.
      cur_tab-f6 = '20'.
      APPEND cur_tab.
      cur_tab-f1 = 'b'.
      cur_tab-f2 = 'aa'.
      cur_tab-f3 = '11'.
      cur_tab-f4 = 'p2'.
      cur_tab-f5 = '30'.
      cur_tab-f6 = '30'.
      APPEND cur_tab.
      cur_tab-f1 = 'b'.
      cur_tab-f2 = 'aa'.
      cur_tab-f3 = '11'.
      cur_tab-f4 = 'p2'.
      cur_tab-f5 = '40'.
      cur_tab-f6 = '30'.
      APPEND cur_tab.
      LOOP AT cur_tab.
        MOVE-CORRESPONDING cur_tab TO sum_tab.
        COLLECT sum_tab.
      ENDLOOP.
      LOOP AT sum_tab.
        READ TABLE cur_tab WITH KEY f1 = sum_tab-f1
                                    f4 = sum_tab-f4.
        IF sy-subrc NE 0.
          WRITE:/ 'Something went very wrong'.
          CONTINUE.
        ENDIF.
        MOVE-CORRESPONDING cur_tab TO final_tab.
        MOVE-CORRESPONDING sum_tab TO final_tab.
        APPEND final_tab.
      ENDLOOP.
      LOOP AT final_tab.
        WRITE:/1 final_tab-f1,
              AT 5 final_tab-f2,
              AT 10 final_tab-f3,
              AT 15 final_tab-f4,
              AT 20 final_tab-f5,
              AT 25 final_tab-f6.
      ENDLOOP.
    and the output
    a   aa   11   p1     30   30  
    b   aa   11   p2     70   60  

  • Help needed to optimize the query

    Help needed to optimize the query:
    The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
    This is having high cost and taking around 15mins to execute.
    Can anyone help to fine-tune this??
       SELECT c.H_SEC,
                    c.S_PAID,
                    c.H_PAID,
                    table_c.EFF_DATE
       FROM    MTCH_TBL c
                    LEFT OUTER JOIN
                       (SELECT b.SEC_ALIAS,
                               b.EFF_DATE,
                               b.INSTANCE
                          FROM HIST_TBL b
                         WHERE b.EFF_DATE =
                                  (SELECT MAX (b2.EFF_DATE)
                                     FROM HIST_TBL b2
                                    WHERE b.SEC_ALIAS = b2.SEC_ALIAS
                                          AND b.INSTANCE =
                                                 b2.INSTANCE
                                          AND b2.EFF_DATE >= '01-Jan-2007')
                               OR b.EFF_DATE IS NULL) table_c
                    ON  table_c.SEC_ALIAS=c.H_SEC
                       AND table_c.INSTANCE = 100;

    To start with, I would avoid scanning HIST_TBL twice.
    Try this
    select c.h_sec
         , c.s_paid
         , c.h_paid
         , table_c.eff_date
      from mtch_tbl c
      left
      join (
              select sec_alias
                   , eff_date
                   , instance
                from (
                        select sec_alias
                             , eff_date
                             , instance
                             , max(eff_date) over(partition by sec_alias, instance) max_eff_date
                          from hist_tbl b
                         where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
                            or eff_date is null
               where eff_date = max_eff_date
                  or eff_date is null
           ) table_c
        on table_c.sec_alias = c.h_sec
       and table_c.instance  = 100;

  • URGENT HELP NEEDED ... Tomcat Realm and JRE1.4 plug-in problem

    I have tried the Security Realm of Tomcat. Since I do not have
    an LDAP server, I decided to use the Tomcat-users.xml file in
    Tomcat\conf directory.
    I added the following lines of code in the web.xml file.
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <!-- NOTE: This role is not present in the default users file -->
    <role-name>webviewer</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Manager Application</realm-name>
    </login-config>
    The <role-name> "webviewer" is added into "Tomcat-Users.xml" as the following:
    <tomcat-users>
    <user name="test" password="password" roles="webviewer" />
    </tomcat-users>
    So, now when we type the url: http://localhost:8080/adbpdbre/default.htm, TOMCAT shows a dialog box asking for UserName: and Password:Now, only when we give the username and password, it shows the page. This is exactly what we want.
    But the problem now is, this default.htm page, has 5 links to 5 applets. The first time that I click on one of these links, the JRE plug of 1.4 shows a dialog again asking for the username and password. Till I dont provide the username and password the system doesnt go ahead and applet doesnt load. I do not want the JRE to ask me for the username/passwords again..How to avoid this ?
    Can you give me some more information on this. Ultimately in the production usage, we will be using LDAP and not Tomcat's memory realm.
    URGENT HELP NEEDED ... I need to get back to my client on this.
    Help would be v. much appreciated.

    In the config file, you 're essentially saying that you want Tomcat to prompt for usr/passw on every request (url-pattern = /*) made by a 'webviewer', and that's exactly what Tomcat is doing.
    Consider using specific url-patterns & roles for resources to be protected. If for now, all you need is to protect the first page, use a more specific url-pattern.
    Just an advice : if you'll be using LDAP in production, do not waste time with Tomcat's Security Realm and the BASIC authentication type, since the two have not much in common. Start reading doc on LDAP, and code a prototype, or even better, a vertical slice of the app (i.e a proof of concept).

  • How do I update multiple characters at specified positions in a string while avoiding looping?

    DECLARE @mytestvar NVARCHAR(MAX) = '2,3,4,5,6'
    UPDATE tblMessageState
    SET UserFilingCategoryStatus = STUFF(UserFilingCategoryStatus,CONVERT(INT,a.Value),1,'0')
    FROM dbo.udtfSplit(@mytestvar, ',') a
    WHERE MessageID = 1
    This is the farthest I have gotten. This only updated the character in position 2 ...I also want it to update the character in position 3 and 4 etc... or whatever positions I input. Is there some CROSS APPLY trickery I could use ? I really want to avoid looping.
    Paul Mauriello

    ALTER FUNCTION dbo.fnparseAndreplaceString
    @vSplitStr varchar(1000),
    @vChangePosStr varchar(100)
    RETURNS varchar(100)
    AS
    BEGIN
    Declare @vMyString varchar(100) = @vSplitStr
    Declare @vChangeStr varchar(100) = @vChangePosStr
    Declare @vResult varchar(100) = ''
    Declare @vTable Table (ID int, val nvarchar(100))
    ;With wcte as (
    Select Row_Number()over(Order by name) ID from sys.columns
    ) --Insert into @vTable
    Select @vResult = (Select '' + Case when b.value is Not Null then '1' else Right(SubString(@vMyString,1,ID),1) end
    from wcte a
    Left Outer Join dbo.fnSplit(@vChangePosStr,',') b on b.value = a.ID
    where ID <= Len(@vMyString)
    For XML Path(''))
    --),1,1,'')
    RETURN @vResult
    END
    GO
    Create the function as above and then you can use it in your UPDATE query;
    Declare @vMyString varchar(100) = '4567899243'
    Declare @vChangeStr varchar(100) = '2,4,8' -- I will replace these positions with 1.
    Declare @vTableTest Table (ID int, val varchar(10))
    Insert into @vTableTest
    Select 1, '123456789' Union All
    Select 2, '456783457'
    Select *, dbo.fnparseAndreplaceString (val,@vChangeStr) from @vTableTest
    Update @vTableTest
    Set val = dbo.fnparseAndreplaceString (val,@vChangeStr)
    Select * from @vTableTest
    Technically you will need two functions in your code. One is above and the other one is dbo.fnSplit. I hope you have the split function that splits the string on the basis of a given character.
    Please visit my Blog for some easy and often used t-sql scripts
    My BizCard

  • 1941W configuration help needed

    Our Deployment Scenario:-
    1941W Gigabit Ethernet 0/0 is connected to the PPOE connection of the ISP.
    Gigabit Ethernet 0/1 is connected to the wired LAN
    I have created 2 wireless radio Cisco_Kamran_BGN which is operating at 2.4 Ghz Devices and Cisco_Kamran_A which is operating at 5Ghz Devices.
    I have created 2 VLans for the Wireless.
    Vlan 10 for Cisco_Kamran_A        192.168.10.x
    Vlan 11 for Cisco _Kamran_BGN   192.168.11.X
    The problem is the Wireless users are not getting the IP address from the respective DHCP server which has been configured on the Router.
    Can please any from the community help me and show me where I am missing the configuration.
    Please find my router  & ap configuration below.
    Router Configuration
    Router#
    sh run
    Building configuration...
    Current configuration : 3022 bytes
    ! No configuration change since last restart
    version 15.1
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    hostname Router
    boot-start-marker
    boot-end-marker
    enable secret 5 $1$TdQt$npYeaf/W0kRElcfMggzJ31
    no aaa new-model
    service-module wlan-ap 0 bootimage autonomous
    no ipv6 cef
    ip source-route
    ip cef
    ip dhcp excluded-address 192.168.1.1 192.168.1.50
    ip dhcp excluded-address 192.168.10.1 192.168.10.10
    ip dhcp excluded-address 192.168.11.1 192.168.11.10
    ip dhcp pool DHCP
    network 192.168.1.0 255.255.255.0
    default-router 192.168.1.1
    dns-server 195.229.241.222 213.42.20.20
    ip dhcp pool Cisco_Kamran_A
    network 192.168.11.0 255.255.255.0
    default-router 192.168.11.1
    dns-server 195.229.241.222 213.42.20.20
    ip dhcp pool Cisco_Kamran_BGN
    network 192.168.10.0 255.255.255.0
    default-router 192.168.10.1
    dns-server 195.225.241.222 213.42.20.20
    multilink bundle-name authenticated
    crypto pki token default removal timeout 0
    license udi pid CISCO1941W-E/K9 sn FCZ1553C1VK
    hw-module ism 0
    redundancy
    bridge irb
    interface Embedded-Service-Engine0/0
    no ip address
    shutdown
    interface GigabitEthernet0/0
    ip address 192.168.1.1 255.255.255.0
    ip nat inside
    ip virtual-reassembly in
    duplex auto
    speed auto
    interface wlan-ap0
    description Service module interface to manage the embedded AP
    ip unnumbered GigabitEthernet0/0
    arp timeout 0
    no mop enabled
    no mop sysid
    interface GigabitEthernet0/1
    no ip address
    duplex auto
    speed auto
    pppoe enable group global
    pppoe-client dial-pool-number 1
    interface Wlan-GigabitEthernet0/0
    description Internal switch interface connecting to the embedded AP
    switchport mode trunk
    no ip address
    interface Vlan1
    no ip address
    interface Vlan10
    ip address 192.168.10.1 255.255.255.0
    ip access-group DSL_ACCESSLIST in
    ip nat inside
    ip virtual-reassembly in
    interface Vlan11
    ip address 192.168.11.1 255.255.255.0
    ip access-group DSL_ACCESSLIST in
    ip nat inside
    ip virtual-reassembly in
    interface Dialer1
    ip address negotiated
    ip nat outside
    ip virtual-reassembly in
    encapsulation ppp
    dialer pool 1
    ppp authentication pap callin
    ppp pap sent-username xxxxxx password 0 xxxxxx
    ppp ipcp route default
    ip forward-protocol nd
    no ip http server
    no ip http secure-server
    ip nat inside source list DSL_ACCESSLIST interface Dialer1 overload
    ip access-list extended DSL_ACCESSLIST
    permit ip 192.168.0.0 0.0.255.255 any
    control-plane
    line con 0
    password xxxxxx
    login
    line aux 0
    line 2
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    stopbits 1
    line 67
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    line vty 0 4
    password xxxxxx
    login
    transport input all
    scheduler allocate 20000 1000
    end
    Router#
    Router#
    Router#
    Access Point Configuration
    ap#
    ap#
    ap#
    sh run
    Building configuration...
    Current configuration : 2603 bytes
    version 12.4
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    service password-encryption
    hostname ap
    enable secret 5 $1$JxdQ$a2/00bWJuhUKP9QLC94YD/
    no aaa new-model
    dot11 syslog
    dot11 ssid Cisco_Kamran_A
       authentication open
       authentication key-management wpa
       guest-mode
       wpa-psk ascii 7 1045081417161C5A555C7A7B
    dot11 ssid Cisco_Kamran_BGN
       authentication open
       authentication key-management wpa
       guest-mode
       wpa-psk ascii 7 020D05561907017015165949
    username Cisco password 7 14341B180F0B
    bridge irb
    interface Dot11Radio0
    description 802.11bgn radio
    no ip address
    no ip route-cache
    encryption mode ciphers aes-ccm
    broadcast-key change 3600
    ssid Cisco_Kamran_BGN
    antenna gain 0
    station-role root
    bridge-group 11
    bridge-group 11 subscriber-loop-control
    bridge-group 11 block-unknown-source
    no bridge-group 11 source-learning
    no bridge-group 11 unicast-flooding
    bridge-group 11 spanning-disabled
    interface Dot11Radio1
    description 802.11a radio
    no ip address
    no ip route-cache
    encryption mode ciphers aes-ccm
    ssid Cisco_Kamran_A
    antenna gain 0
    no dfs band block
    channel dfs
    station-role root
    bridge-group 10
    bridge-group 10 subscriber-loop-control
    bridge-group 10 block-unknown-source
    no bridge-group 10 source-learning
    no bridge-group 10 unicast-flooding
    bridge-group 10 spanning-disabled
    interface GigabitEthernet0
    description the embedded AP GigabitEthernet 0 is an internal interface connecting AP with the host router
    no ip address
    no ip route-cache
    bridge-group 1
    no bridge-group 1 source-learning
    bridge-group 1 spanning-disabled
    interface GigabitEthernet0.10
    description 802.11a bridge
    encapsulation dot1Q 10
    no ip route-cache
    bridge-group 10
    bridge-group 10 subscriber-loop-control
    bridge-group 10 block-unknown-source
    no bridge-group 10 source-learning
    no bridge-group 10 unicast-flooding
    bridge-group 10 spanning-disabled
    interface GigabitEthernet0.11
    description 802.11bgn bridge
    encapsulation dot1Q 11
    no ip route-cache
    bridge-group 11
    bridge-group 11 subscriber-loop-control
    bridge-group 11 block-unknown-source
    no bridge-group 11 source-learning
    no bridge-group 11 unicast-flooding
    bridge-group 11 spanning-disabled
    interface BVI1
    ip address dhcp client-id GigabitEthernet0
    no ip route-cache
    ip http server
    no ip http secure-server
    ip http help-path http://www.cisco.com/warp/public/779/smbiz/prodconfig/help/eag
    bridge 1 route ip
    line con 0
    no activation-character
    line vty 0 4
    login local
    end
    ap#
    ap#
    ap#

    Hi Stepehen,
    Did the configuration as per your advice  but i am getting the below mentioned error which i have highlighted it in red. Please advice what needs to be done.
    Home
    Re: 1941W configuration help needed
    created by Stephen Rodriguez in Getting     Started with Wireless - View the full discussion
    conf t
    interface     Dot11Radio0
    no ssid     Cisco_Kamran_BGN
    no encryption mode     ciphers aes-ccm
    exit
    interface     Dot11Radio1
    no encryption mode     ciphers aes-ccm
    no ssid     Cisco_Kamran_A
    exit
    dot11 ssid     Cisco_Kamran_A
    vlan 10
    dot11 ssid     Cisco_Kamran_BGN
    vlan 11
    exit
    interface     Dot11Radio0
    encryption vlan 11     mode ciphers aes
    ssid     Cisco_Kamran_BGN
    exit
    interface     dot11radio0.1
    encapsulation     dot1q 1 native
    bridge-group 1
    interface     dot11radio 0.11
    encapsulation     dot1q 11
    bridge-group 11
    Configuration of     subinterfaces and main interface
    within the same bridge     group is not permitted
    exit
    interface     Dot11Radio1
    encryption vlan 10     mode ciphers aes-ccm
    ssid     Cisco_Kamran_A
    interface     dot11radio1.1
    encapsulation     dot1q 1 native
    bridge-group 1
    interface     dot11radio1.10
    encapuslation     dot1q 10
    bridge-group 10
    Configuration of subinterfaces and main     interface
    within the same bridge     group is not permitted
    end
    wr
    Reply to this message by going to Home
    Start a new discussion in Getting Started with Wireless at Home

  • I need to avoid my security question, because i dont remember the answers. and i need to authorize my account in order to purchase from the appstore

    I need to avoid my security questions, i dont know the answers, i dont remember it, and i have 30dlls on my apple id that i cant use cause of the security block. help me, ive been unable to purchase anything for about a 7 months now

    Go to https://iforgot.apple.com and follow the directions.

  • Messaging:System Error(-10)HELP NEEDED!NEED BEFORE...

    Messaging: System Error(-10) [Nokia N70] URGENT HELP NEEDED! - NEEDE BEFORE WED 21ST MAY '08 - BUT HELP OTHERWISE APPRECIATED!______________________________
    Hey,
    I need this help before Wednesday 21st May 2008 as I am going abroad and urgently need my phone. I have had my phone for just over a year now and I have never had any problems with it up until now.... Think you can help...?
    This is the scenario. My messages are saved under my nokia N70's MMC memory card and when I get a message there are a number of problems.
    1) My phone does not vibrate or alert me when a message comes in. I have checked my profile settings and they are all up to volume.
    2) When the messages come through they are not displayed on the main window of the phone as "1 New Message Received" but in the top corner with a little envelope icon. I know the icon normally comes up but the "1 New messge received part doesn't come up.
    3)When "1 New Message Reveived" is not displayed on the main window I go into the "INBOX". When I click inbox on "Messaging" the phone displays an error saying: Messaging: System Error(-10) with a red exclamaion mark. The I can not write any messages, view sent, or drafts.
    I have tried to change me message settings by going on "Messaging"> Left Click "Settings" > "Other" > "Memory in use" and selected "Phone Memory". This works but then my I looses all my previous messages.
    4)My phone is also dead slow. I click menu and it takes at least five minutes to load menu.
    IF YOU COULD HELP ME ON ANY OF THESE ISSUES I WOULD BE MAJORLY GREATFUL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks Soo Much,
    Robert__________

    U said in another post u've tried all my solutions = =?
    On that post its for Nokia N95 u kno? Although the problem is similar, but different phone model can lead to quite different solutions.
    Are u sure u tried all my solutions?
    have u tried this?:
    /discussions/board/message?board.id=messaging&message.id=7926#M7926
    Also format ur memory card, do not use content copier! dont install too much softwares, as ur phone model is old and doesnt have much space.
    This is from NOkia, sometimes does work depending on ur situation:
    Memory low
    Q: What can I do if my device memory is low?
    A: You can delete the following items regularly to avoid
    memory getting low:
    • Messages from Inbox, Drafts, and Sent folders in Messaging
    • Retrieved e-mail messages from the device memory
    • Saved browser pages
    • Images and photos in Gallery
    To delete contact information, calendar notes, call timers, call cost timers, game scores, or any other data, go to the respective application to remove the data. If you are deleting multiple items and any of the following notes are shown: Not enough memory to perform operation. Delete some data first. or Memory low. Delete some data., try deleting items one by one (starting from the smallest item).
    use device status http://handheld.softpedia.com/get/Desktop-and-Shell/Windows/Nokia-Device-Status-57673.shtml
    to maybe let me see what u got on ur phone (by saving/exporting report).
    Make sure u have the latest firmware! Updating firmware is like a hard reset but also upgrade.
    Message Edited by goldnebula on 20-May-2008 02:05 PM

Maybe you are looking for

  • IPod can not update, playlists no longer exist

    For some reason after downloading the newest version of iTunes (though it could have been from something I did) everytime I try to update my iPOD with the latest songs and playlists I get a message that reads "songs on the iPod XXXXX can not be updat

  • Table_From_Block Build-in Package is not working in Oracle 10G

    Hi Table_From_Block Build-in Package is not working in Oracle 10G Kindly advice..

  • [Help Accessing External usb 1TB HD from windows 7 on Imac with Lion]

    Hello to everyone, i would like some help and im not finding any solution on how to solve the problem. I upgraded from snow leopard to Lion, where i could share without any problem every file on mac hd or the external hd, no problems at all. Now usin

  • BAPI for XD02 (Customer Update)

    Hi Everyone, I am unable to find any BAPI which updates selective fields from transaction XD02 in background. Does any one have any info on the same. Thanks, Altaf Shaikh.

  • Catching Incoming Payments As They Occur

    I have an issue to collect data on incoming payments as they occur.  In other words, as a payments is entered on an AR Invoice, I need to update some sales history data in a user table using the SDK.  This does not seem to present a problem except fo