hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : SQL Server question
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

SQL Server question

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-09-2010, 01:41 AM
creativeartist creativeartist is offline
Junior Guru
 
Join Date: Jul 2006
Location: India
Posts: 228

SQL Server question


2 questions related to SQL server

How to get the id of current inserted row using SQL server?

Procedure or view which will be fast for a (select * from operation)

__________________
Joseph
Hire Designers - DesignersForHire.com


Reply With Quote


Sponsored Links
  #2  
Old 09-09-2010, 06:22 PM
REMX REMX is offline
Junior Guru
 
Join Date: Sep 2010
Location: London
Posts: 196
Code:
INSERT INTO Users (FirstName) VALUES ('John');
SELECT ID AS LastID FROM Users WHERE ID = @@IDENTITY;
Or you can just use
Code:
SELECT @@IDENTITY
Not sure about the second one sorry


Last edited by REMX; 09-09-2010 at 06:27 PM.
Reply With Quote
  #3  
Old 09-10-2010, 02:00 AM
plumsauce plumsauce is offline
******* Unleaded
 
Join Date: Feb 2004
Posts: 3,788
The indexing will determine what works best for a select.

select * is a very bad idea, always explicitly select columns by name

__________________
edgedirector.com
managed dns global failover and load balance (gslb)
exactstate.com
uptime report for webhostingtalk.com

Reply With Quote
Sponsored Links
  #4  
Old 09-10-2010, 06:23 AM
CoderJosh CoderJosh is offline
Web Hosting Master
 
Join Date: May 2008
Location: Germany
Posts: 674
Quote:
Originally Posted by plumsauce View Post

select * is a very bad idea, always explicitly select columns by name
Indeed, you should really avoid this.

__________________
CoderJosh | Web Application Developer and Linux Server Admin
█ SysAdmin Services | WebApp Coding | Tuning | Hardening
█ Available for hire on a per-project or part-time basis | http://www.coderjosh.com/


Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Server Question - MS SQL + Plesk inprogrammer2008 Dedicated Server 2 01-07-2009 12:39 PM
Microsoft SQL Server question about TIMESTAMP type fileds jimlundeen Programming Discussion 7 09-30-2005 07:29 PM
Best/Cheapest UK Dedicated Server Provider & SQL Server Question tonyw123 Dedicated Server 4 08-05-2005 08:59 PM
SQL Server 2000 Data Cube Question netmanpro Programming Discussion 0 10-20-2004 07:37 PM
Microsoft SQL Server 2000 Question to ask? Jedito Web Hosting 6 09-06-2002 02:26 PM

Related posts from TheWhir.com
Title Type Date Posted
Web Host OrcsWeb Offers Support for Windows Server 2012 Web Hosting News 2012-08-24 11:08:35
Java-Based Web Server Resin Claims it Outperforms NGINX Web Server in Benchmark Tests Web Hosting News 2012-08-22 10:59:49
WHIR TV: Backup Software Firm R1Soft Discusses Brand Transition to Idera Whir Tv 2012-08-27 14:08:15
Web Host 1&1 Enhances Dedicated Server Line with 32 Core, 64 GB RAM Server Web Hosting News 2011-12-20 15:30:05
DiscountASP.NET Launches Free Beta for Microsoft SQL Server 2012 Hosting Web Hosting News 2011-12-13 22:02:03


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?