Search Results

Search found 1385 results on 56 pages for 'ibn ali al turki'.

Page 6/56 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Wireless card unseen by lspci

    - by al-Amjad Tawfiq Isstaif
    I installed both Ubuntu 8.04 and 10.04. I tried to install the wireless card. although I succeeded in installing the driver using ndiswrapper, it tells me that the hardware is not present. When I use lspci, it doesn't list it. I have this laptop model and I think it should have the same entry about the wireless card here: http://ubuntuforums.org/showthread.php?t=1810193 Could the problem be other than hardware malfunction?

    Read the article

  • Weird behavior when using pointers [migrated]

    - by Kinan Al Sarmini
    When I run this code on MS VS C++ 2010: #include <iostream> int main() { const int a = 10; const int *b = &a; int *c = (int *)b; *c = 10000; std::cout << c << " " << &a << std::endl; std::cout << *c << " " << a << " " << *(&a) << std::endl; return 0; } The output is: 0037F784 0037F784 10000 10 10 The motivation for writing that code was this sentence from "The C++ Programming Language" by Stroustrup: "It is possible to explicitly remove the restrictions on a pointer to const by explicit type conversion". I know that trying to modify a constant is conceptually wrong, but I find this result quite weird. Can anyone explain the reason behind it?

    Read the article

  • Can't access my partitions after installing Ubuntu

    - by Manaf Al-Sarraf
    I installed Ubuntu 13.4 replace with win 8 after installation complete I can't access my partitions and receive a message like this : Error mounting /dev/sda5 at /media/manaf/01CD6C0800CEE670: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda5" "/media/manaf/01CD6C0800CEE670"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Failed to mount '/dev/sda5': Operation not permitted The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option." Thanks for helping :)

    Read the article

  • Partitioning set into subsets with respect to equality of sum among subsets

    - by Al.Net
    let say i have {3, 1, 1, 2, 2, 1,5,2,7} set of numbers, I need to split the numbers such that sum of subset1 should be equal to sum of subset2 {3,2,7} {1,1,2,1,5,2}. First we should identify whether we can split number(one way might be dividable by 2 without any remainder) and if we can, we should write our algorithm two create s1 and s2 out of s. How to proceed with this approach? I read partition problem in wiki and even in some articles but i am not able to get anything. Can someone help me to find the right algorithm and its explanation in simple English?

    Read the article

  • Why are my sprite sheet's frames not visible in Cocos Builder?

    - by Ramy Al Zuhouri
    I have created a sprite sheet with zwoptex. Then I just dragged the .plist and .png files to my Cocos Builder project. After this I wanted to take a sprite frame and set it to a sprite: But the sprite image is empty! At first I thought it was just empty in Cocos Builder, and that it must have been working correctly when imported to a project. But if I try to run that scene with CCBReader I still see an empty sprite. Why?

    Read the article

  • shortcuts/links to windows partition disappear on reboot

    - by al kirsch
    Ubuntu 11.10 recognizes my Windows 7 partition OK. Since that is where my work has historically been, I created links to various files and folders there. Everythings fine until I reboot. Then the icon reverts to the generic and I am informed the link is no longer valid. I created the links by right-clicking the folder or file and selecting "Make Link" in the Windows folder, then dragging it to the Ubuntu desktop. How can I fix this? BTW, it worked OK with Kubuntu; I got seduced by the sexy Unity desktop.....

    Read the article

  • Recovering a deleted partition after installing Ubuntu?

    - by al akhfiya
    I have a serious problem. I Installed Ubuntu 13.04 on my Laptop. I format all partitions (Windows)/(Erase all data and Install Ubuntu):( . How do I recover my accidentally lost Windows partitions after installing Ubuntu?. I try using PartitionWizard and Testdisk. But cannot recovery partition, Partitionwozard and Testdisk only detected the linux partition (Linux/Ext4 and Linux/Swap). I hope the answer. Please help. and Sorry for my English is not good. Thanks :)

    Read the article

  • How do Python and PHP compare for ecommerce?

    - by Ibn Saeed
    If I were to start an ecommerce store, which language would you suggest I start with? Python or PHP? And would it be wise to use Python for an ecommerce site in favor of PHP? PHP has lots of shopping carts, both open source and commercial. Is Python the future of Web Development ? Edit: I would like to clear out that i am not asking for Shopping carts solutions and links to them.

    Read the article

  • Java Code for calculating Leap Year, is this code correct ?

    - by Ibn Saeed
    Hello I am following "The Art and Science of Java" book and it shows how to calculate a leap year. The book uses ACM Java Task Force's library. Here is the code the books uses: import acm.program.*; public class LeapYear extends ConsoleProgram { public void run() { println("This program calculates leap year."); int year = readInt("Enter the year: "); boolean isLeapYear = ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)); if (isLeapYear) { println(year + " is a leap year."); } else println(year + " is not a leap year."); } } Now, this is how I calculated the leap year. import acm.program.*; public class LeapYear extends ConsoleProgram { public void run() { println("This program calculates leap year."); int year = readInt("Enter the year: "); if ((year % 4 == 0) && year % 100 != 0) { println(year + " is a leap year."); } else if ((year % 4 == 0) && (year % 100 == 0) && (year % 400 == 0)) { println(year + " is a leap year."); } else { println(year + " is not a leap year."); } } } Is there anything wrong with my code or should i use the one provided by the book ? EDIT :: Both of the above code works fine, What i want to ask is which code is the best way to calculate the leap year.

    Read the article

  • How to automatically show Title of the Entries/Articles in the Browser Title Bar in ExpressionEngine 2?

    - by Ibn Saeed
    How would I output the title of an entry in ExpressionEngine and display it in the browser's title bar? Here is the content of my page's header: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Site</title> <link rel="stylesheet" href="{stylesheet=site/site_css}" type="text/css" media="screen" /> </head> What I need is for each page to display the title of the entry in my browser's title bar — how can I achieve that? Part of UPDATED Code: Here is how i have done it : {exp:channel:entries channel="news_articles" status="open|Featured Top Story|Top Story" limit="1" disable="member_data|trackbacks|pagination"} {embed="includes/document_header" page_title=" | {title}"} <body class="home"> <div id="layoutWrapper"> {embed="includes/masthead_navigation"} <div id="content"> <div id="article"> <img src="{article_image}" alt="News Article Image" /> <h4>{title}</h4> <h5><span class="by">By</span> {article_author}</h5> <p>{entry_date format="%M %d, %Y"} -- Updated {gmt_edit_date format="%M %d, %Y"}</p> {article_body} {/exp:channel:entries} </div> What do you think?

    Read the article

  • Visual Studio Team System 2008 - messy formatting/control characters/marks in source code

    - by AL
    Hi, I don't know what I did but somehow the IDE has started displaying a green dot whenever I press spacebar and a green arrowhead whenever I press TAB. The source has become littered with these characters all over and I am finding it very difficult to code in the presence of so many formatting marks. I have tried to search a solution on Google but couldn't perhaps enter the right keywords so haven't been able to fix the behavior. Is there any way I can stop VS2008 IDE from littering my source code with these green dots and arrowheads whenever I press spacebar/tab? I would be really thankful for this help. Thanks, -AL

    Read the article

  • Visual Studio 2008 - formatting/control characters/marks

    - by AL
    Hi, I don't know what I did but somehow the IDE has started displaying a green dot whenever I press spacebar and a green arrowhead whenever I press TAB. The source has become littered with these characters all over and I am finding it very difficult to code in the presence of so many formatting marks. I have tried to search a solution on Google but couldn't perhaps enter the right keywords so haven't been able to fix the behavior. Is there any way I can stop VS2008 IDE from littering my source code with these green dots and arrowheads whenever I press spacebar/tab? I would be really thankful for this help. Thanks, -AL PS: Re-posting the question as I am new to this forum and probably couldn't see the email notification option earlier. My apologies for this inconvenience.

    Read the article

  • How do you use jQuery .data() to store html?

    - by Al
    Hi all - when I look up the syntax for .data(), it gives examples like this: $('body').data('foo', 52); I am doing AJAX loads and I was wondering if it is possible to store the incoming html using .data() so once the content is loaded, I would not need to do another AJAX load if the same link is clicked again - I would check to see if the .data key is empty. Would something like this work?: To load the contents of a #ajaxdiv into storage: $('body').data('storage', div#ajaxdiv.html()); To test if the data has already been loaded: if $('body').data('storage') != '' { div#ajaxdiv.html($('body').data('storage')); } Thanks in advance!! Al

    Read the article

  • Lookup function not working (RS SP2)

    - by Al Reyes
    Hi, I made the upgrade to SP2. I'm trying to use the Lookup function to link data from two different servers. I'm trying first a simple exercise linking data from two datasets from the same server, having one dataset with journals and the other with the account description. My Expression looks like this at a field on the table I have: =Lookup(Fields!ACTINDX.Value,Fields!ACTINDX.Value,Fields!ACTDESCR.Value,"ACCTINFO") I made sure of the names and using only uppercases for datasets and fields but I'm receiving the following message when I try to preview: "An error occurred during local report processing. The definition of the report '/DETAIL' is invalid. The Value expression for the text box 'ACTINDX' refers to the field 'ACTDESCR'. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope". I'll appreciate any suggestions. Regards, Al

    Read the article

  • MS Word 2010: Hide citation title when 2 publications by same first author from different years are in one citation block

    - by srunni
    I'm trying to hide the display of the titles for two publications by the same first author from different years that are in the same citation block. By default, the title is shown in citations when there are two publications by the same author in a given document. The easiest way to get around this is to right click on the citation, click "Edit Citation", and then suppress the title. However, the issue with this is that if there are 2 citations in 1 citation block (i.e., "(Smith, J., et al. 2010, Smith, J., et al. 2011)" rather than "(Smith, J., et al. 2010) (Smith, J., et al. 2011)"), then using that suppress option only suppresses the title for the first citation (in this case, the 2010 publication). OTOH, if I try to initially insert the publications in separate citation blocks, I can suppress the title in both citations, but I can't cut and paste one into the other's citation block. I can click "Cut" and the citation that was just cut disappears, but the "Paste" option is not available when my cursor is in the second citation block. Any ideas? Thanks!

    Read the article

  • apache htaccess rewrite rules make redirection loop

    - by Ali
    Hi guys, Have a very strange problem with Apache .htaccess URL Rewriting and Redirection. Here's my setup: I have a zend application with a single point of entry (index.php) directly under my apache document root (call this the "public" folder). I also have all other public files (images, js, css, etc.) under the public folder. Here, I also have a wordpress blog under the "blog" folder. There's an empty test folder too The Problem When I go to mydomain.com/blog, I get redirected to http://www.theredpin.com/blog (correctly), then to http://www.theredpin.com/blog/ (just with an extra / at end), finally to http://theredpin.com/blog/ -- and we're back where we started. The loop continues. What I don't understand is why would wordpress try to remove the www? I'm guessing it's wordpress because my empty test folder acts just fine! PLEASE HELP. I"M REALLY DESPERATE :( Thank you very much Other things that happen: When I go to mydomain.com, i correctly get redirected to www.mydomain.com When I go to www.mydomain.com, i correctly stay where I am When I go to www.mydomain.com/test or mydomain.com/test, behaviour is correct. Setup So my .htaccess file does the following: If there's no www., then add it and do a 301 redirect. Here's the code I use RewriteCond %{HTTP_HOST} ^mydomain.com [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] If the request is NOT for a resource (image, etc.), or the blog, then load zend application by rewriting to index.php RewriteRule !((^blog(/)?.*$)|(.(js|ico|gif|jpg|jpeg|png|css|cur|JPG|html|txt))$) index.php Thanks again for all your help!!! Ali

    Read the article

  • JQuery Thickbox - Can't get it to display

    - by Ali
    Hi All, I am using JQuery for the first time today. I can't make it to work (It simple doesnt show up). I want to display inline content using Thickbox (Eventually I will be displaying a PDF in an iframe). I have included all the javascript and css files etc. and referenced them as in code below. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="JQueryLearning._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script src="Scripts/thickbox.js" type="text/javascript"></script> <script src="Scripts/thickbox-compressed.js" type="text/javascript"></script> <script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script> <link href="App_Themes/Theme/Css/thickbox.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <div> <a href="#TB_inline?height=50&width=300&inlineId=hiddenModalContent" title="Simple Demo" class="thickbox">Show hidden content.</a> <div id="hiddenModalContent" style="display: none;"> <div style="text-align: center;"> Hello ThickBox!</div> </div> </div> </form> </body> </html> Am I missing something? Thanks, Ali

    Read the article

  • Cannot cause $(this).find("a").click(); to fire using JQuery

    - by Ali
    Hi Everyone, I have a small question which should be very easy for the jquery experts out there. I am trying to follow http://aspdotnetcodebook.blogspot.com/2010/01/page-languagec-autoeventwireuptrue.html to be able to perform an action on gridview row double click. I can redirect to another page fine (as shown in the example) but I cannot cause the $(this).find("a").click(); to fire. Below is my GridView markup. <asp:GridView ID="gvCustomers" runat="server" DataSourceID="odsCustomers" CssClass="datagrid" GridLines="None" AutoGenerateColumns="False" DataKeyNames="Customer_ID" PageSize="3" AllowPaging="True" AllowSorting="True" OnRowCommand="gvCustomers_RowCommand" OnRowDataBound="gvCustomers_RowDataBound"> <Columns> <asp:BoundField DataField="Customer_ID" HeaderText="ID" ReadOnly="true" Visible="false" /> <asp:BoundField DataField="Customer_FirstName" HeaderText="First Name" ReadOnly="true" /> <asp:BoundField DataField="Customer_LastName" HeaderText="Last Name" ReadOnly="true" /> <asp:BoundField DataField="Customer_Email" HeaderText="Email" ReadOnly="true" /> <asp:BoundField DataField="Customer_Mobile" HeaderText="Mobile" ReadOnly="true" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="lnkButton" runat="server" CommandName="showVehicles" CommandArgument='<%# Eval("Customer_ID") %>' ></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> <EmptyDataTemplate> Sorry No Record Found. </EmptyDataTemplate> </asp:GridView> I just cant make it work as the author has suggested: /* or you could have a hidden LinkButton in the row (Text="" or not set) that you could trigger. Make sure you set the CommandName="Something" and CommandArgument="RecordId" */ on the OnCommand of linkButton, I have my server side method which I would like to fire. Any ideas will be most apprecited. Thanks, Ali

    Read the article

  • how to combine widget webapp framework with SEO-friendly CSS and JS files

    - by Ali
    Hi guys, I'm writing a webapp using Zend framework and a homebrew widget system. Every widget has a controller and can choose to render one of many views if it chooses. This really helps us modularize and reconfigure and reuse the widgets anywhere on the site. The Problem is that the views of each widget contain their own JS and CSS code, which leads to very messy HTML code when the whole page is put together. You get pockets of style and script tags everywhere. This is bad for a lot of different reasons as I'm sure you know, but it has a profound effect on our SEO as well. Several solutions that I've been able to come up with: Separate the CSS and JS of every view of every widget into its own file - this has serious drawbacks for load times (many more resources have to be loaded separately) and it makes coding very difficult as now you have to have 3-4 files open just to edit a widget. combine the all the widget CSS into a single file (same with JS) - would also lead to a massive load when someone enters the site, mixes up the CSS and the JS for all widgets so it's harder to keep track of them, and other problems that I'm sure you can think of. Create a system that uses method 1 (separate CSS and JS for every widget), when delivering the page, stitches all CSS and JS together. This obviously needs more processing time and of course the creation of such a system, etc. My Question is what you guys think of these solutions or if there are pre-existing solutions that you know of (or any tech that might help) solve this problem. I really appreciate all of your thoughts and comments!! Thanks guys, Ali

    Read the article

  • Scala programming language for beginners, is it a legend?

    - by ali
    Hi every one, I am Ali from Saudi Arabia. undoubtedly, Scala is one of the best programming language for any programmer to learn, but there is "good" problems that is faced especially by beginners, and what seems frustrating that these problems won't solve soon, so as a beginner and on behalf of beginners let me raise these "objective" questions: 1- why scala has no effective and stable development platform, in fact, it suffers many problems with Eclipse, Netbeat, and Intellij. 2- although I have looked for a clear,easy, and understandable explanation of how to get started with Scala, but fortunately, there was no article or guide that deserves to spend the time I have spent to read it. nobody could tell you clear steps that fit you as a beginner who wants to start his"HELLO WORLD" with Scala, while all other languages have its "HELLO WORLD" guides and books. thank you for your time, be sure that you read notes below. 1- I have no experience in programming language before. 2- don't tell me "not to begin with scala", simply, because I will do. 3- OS is windows vista home premium. 4- I hate excuses, such as Scala is new language......etc

    Read the article

  • Grouping on Multiple Field

    - by Nisarg Mehta
    Hi , I am generating XML file from Database as below... <?xml version = '1.0'?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> </T0019> I have taken first two records from generated XSLT. With the use of XSLT I have tried lot to group record on basis of IFTA_LICENSE_NUMBER,IFTA_BASE_COUNTRY,IFTA_BASE_ST ATE,NAME_TYPE,ADDRESS_TYPE but i failed to generated XML like this.. <?xml version="1.0" encoding="UTF-8" ?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_STATUS_CODE>0</IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <IFTA_NAME> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <IFTA_ADDRESS> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> <IFTA_ADDRESS> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY /> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> </IFTA_NAME> </IFTA_ACCOUNT> </T0019>

    Read the article

  • Creating a top-down spaceship

    - by Ali
    I'm creating a top-down 2D space game in LIBGDX for android. When spaceship is going forward it will look like this: when it goes upward I want to change it's direction with a nice animation so it seems like a real spaceship. A between frame would be like this: I have rendered the spaceship in different Z axis degrees from ship0 to ship90. Calculating rotation on XY plane wouldn't be so hard, but I don't know how to calculate the rotation on Z axis so I can choose the right sprite to use.

    Read the article

  • Returning Identity Value in SQL Server: @@IDENTITY Vs SCOPE_IDENTITY Vs IDENT_CURRENT

    - by Arefin Ali
    We have some common misconceptions on returning the last inserted identity value from tables. To return the last inserted identity value we have options to use @@IDENTITY or SCOPE_IDENTITY or IDENT_CURRENT function depending on the requirement but it will be a real mess if anybody uses anyone of these functions without knowing exact purpose. So here I want to share my thoughts on this. @@IDENTITY, SCOPE_IDENTITY and IDENT_CURRENT are almost similar functions in terms of returning identity value. They all return values that are inserted into an identity column. Earlier in SQL Server 7 we used to use @@IDENTITY to return the last inserted identity value because those days we don’t have functions like SCOPE_IDENTITY or IDENT_CURRENT but now we have these three functions. So let’s check out which one responsible for what. IDENT_CURRENT returns the last inserted identity value in a particular table. It never depends on a connection or the scope of the insert statement. IDENT_CURRENT function takes a table name as parameter. Here is the syntax to get the last inserted identity value in a particular table using IDENT_CURRENT function. SELECT IDENT_CURRENT('Employee') Both the @@IDENTITY and SCOPE_IDENTITY return the last inserted identity value created in any table in the current session. But there is little difference between these two i.e. SCOPE_IDENTITY returns value inserted only within the current scope whereas @@IDENTITY is not limited to any particular scope. Here are the syntaxes to get the last inserted identity value using these functions SELECT @@IDENTITY SELECT SCOPE_IDENTITY() Now let’s have a look at the following example. Suppose I have two tables called Employee and EmployeeLog. CREATE TABLE Employee ( EmpId NUMERIC(18, 0) IDENTITY(1,1) NOT NULL, EmpName VARCHAR(100) NOT NULL, EmpSal FLOAT NOT NULL, DateOfJoining DATETIME NOT NULL DEFAULT(GETDATE()) ) CREATE TABLE EmployeeLog ( EmpId NUMERIC(18, 0) IDENTITY(1,1) NOT NULL, EmpName VARCHAR(100) NOT NULL, EmpSal FLOAT NOT NULL, DateOfJoining DATETIME NOT NULL DEFAULT(GETDATE()) ) I have an insert trigger defined on the table Employee which inserts a new record in the EmployeeLog whenever a record insert in the Employee table. So Suppose I insert a new record in the Employee table using following statement: INSERT INTO Employee (EmpName,EmpSal) VALUES ('Arefin','1') The trigger will be fired automatically and insert a record in EmployeeLog. Here the scope of the insert statement and the trigger are different. In this situation if I retrieve last inserted identity value using @@IDENTITY, it will simply return the identity value from the EmployeeLog because it’s not limited to a particular scope. Now if I want to get the Employee table’s identity value then I need to use SCOPE_IDENTITY in this scenario. So the moral is always use SCOPE_IDENTITY to return the identity value of a recently created record in a sql statement or stored procedure. It’s safe and ensures bug free code.

    Read the article

  • Returning Identity Value in SQL Server: @@IDENTITY Vs SCOPE_IDENTITY Vs IDENT_CURRENT

    - by Arefin Ali
    We have some common misconceptions on returning the last inserted identity value from tables. To return the last inserted identity value we have options to use @@IDENTITY or SCOPE_IDENTITY or IDENT_CURRENT function depending on the requirement but it will be a real mess if anybody uses anyone of these functions without knowing exact purpose. So here I want to share my thoughts on this. @@IDENTITY, SCOPE_IDENTITY and IDENT_CURRENT are almost similar functions in terms of returning identity value. They all return values that are inserted into an identity column. Earlier in SQL Server 7 we used to use @@IDENTITY to return the last inserted identity value because those days we don’t have functions like SCOPE_IDENTITY or IDENT_CURRENT but now we have these three functions. So let’s check out which one responsible for what. IDENT_CURRENT returns the last inserted identity value in a particular table. It never depends on a connection or the scope of the insert statement. IDENT_CURRENT function takes a table name as parameter. Here is the syntax to get the last inserted identity value in a particular table using IDENT_CURRENT function. SELECT IDENT_CURRENT('Employee') Both the @@IDENTITY and SCOPE_IDENTITY return the last inserted identity value created in any table in the current session. But there is little difference between these two i.e. SCOPE_IDENTITY returns value inserted only within the current scope whereas @@IDENTITY is not limited to any particular scope. Here are the syntaxes to get the last inserted identity value using these functions SELECT @@IDENTITYSELECT SCOPE_IDENTITY() Now let’s have a look at the following example. Suppose I have two tables called Employee and EmployeeLog. CREATE TABLE Employee( EmpId NUMERIC(18, 0) IDENTITY(1,1) NOT NULL, EmpName VARCHAR(100) NOT NULL, EmpSal FLOAT NOT NULL, DateOfJoining DATETIME NOT NULL DEFAULT(GETDATE()))CREATE TABLE EmployeeLog( EmpId NUMERIC(18, 0) IDENTITY(1,1) NOT NULL, EmpName VARCHAR(100) NOT NULL, EmpSal FLOAT NOT NULL, DateOfJoining DATETIME NOT NULL DEFAULT(GETDATE())) I have an insert trigger defined on the table Employee which inserts a new record in the EmployeeLog whenever a record insert in the Employee table. So Suppose I insert a new record in the Employee table using following statement: INSERT INTO Employee (EmpName,EmpSal) VALUES ('Arefin','1') The trigger will be fired automatically and insert a record in EmployeeLog. Here the scope of the insert statement and the trigger are different. In this situation if I retrieve last inserted identity value using @@IDENTITY, it will simply return the identity value from the EmployeeLog because it’s not limited to a particular scope. Now if I want to get the Employee table’s identity value then I need to use SCOPE_IDENTITY in this scenario. So the moral is always use SCOPE_IDENTITY to return the identity value of a recently created record in a sql statement or stored procedure. It’s safe and ensures bug free code.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >