pagin Matt H: I got a MS Sql question hit me up on AIM when you get this..

Thread Tools
 
Search this Thread
 
Old 03-01-2005, 12:04 PM
  #1  
Member
Thread Starter
 
rfan-r32's Avatar
 
Join Date: Aug 2000
Posts: 3,812
Likes: 0
Received 0 Likes on 0 Posts
Default pagin Matt H: I got a MS Sql question hit me up on AIM when you get this..

rfan622

thanks.
Old 03-01-2005, 12:17 PM
  #2  
New Member
 
Nick-blarg's Avatar
 
Join Date: Feb 2004
Posts: 244
Likes: 0
Received 0 Likes on 0 Posts
Default SELECT beer.type FROM beer.brewery WHERE beer.alcohol > 0.06 AND beer.carbonation > 0

problem solved!
Old 03-01-2005, 12:20 PM
  #3  
Member
Thread Starter
 
rfan-r32's Avatar
 
Join Date: Aug 2000
Posts: 3,812
Likes: 0
Received 0 Likes on 0 Posts
Default

nice..know of anyway to show the columns of that table?
Old 03-01-2005, 12:30 PM
  #4  
New Member
 
Nick-blarg's Avatar
 
Join Date: Feb 2004
Posts: 244
Likes: 0
Received 0 Likes on 0 Posts
Default

"SHOW COLUMNS FROM brewery" would work in MySQL. Not sure about MS SQL.
Old 03-01-2005, 12:35 PM
  #5  
Member
Thread Starter
 
rfan-r32's Avatar
 
Join Date: Aug 2000
Posts: 3,812
Likes: 0
Received 0 Likes on 0 Posts
Default

yeah..i kno mysql..just no mssql
Old 03-01-2005, 01:11 PM
  #6  
New Member
 
Nick-blarg's Avatar
 
Join Date: Feb 2004
Posts: 244
Likes: 0
Received 0 Likes on 0 Posts
Default

I'm not having much luck finding that answer. Good luck.
Old 03-02-2005, 04:46 AM
  #7  
Elder Member
 
Matt H.'s Avatar
 
Join Date: Apr 2001
Posts: 26,881
Likes: 0
Received 0 Likes on 0 Posts
Default *page received*....no IM here at work

post here or email the question....
Old 03-02-2005, 05:59 AM
  #8  
Elder Member
 
Matt H.'s Avatar
 
Join Date: Apr 2001
Posts: 26,881
Likes: 0
Received 0 Likes on 0 Posts
Default If that's the question...

Do you need the output in SQL or are you using a front-end like ASP or .NET?

I can send you the code to do it in the ASP page using the recordset object...I'd have to look it up to do it in SQL. There is probably a system SP in Master that will give you that information.

Let me know.
Old 03-02-2005, 11:12 AM
  #9  
Member
Thread Starter
 
rfan-r32's Avatar
 
Join Date: Aug 2000
Posts: 3,812
Likes: 0
Received 0 Likes on 0 Posts
Default here's another question..

is there any way to get the last inserted row? for example, if i do 'INSERT (fieldname) VALUES ('values')' how would i get the id number that corresponds to that field?

i found 'SELECT @@IDENTITY' on the internet, but it doesn't seem to be working.
Old 03-02-2005, 11:21 AM
  #10  
Elder Member
 
Matt H.'s Avatar
 
Join Date: Apr 2001
Posts: 26,881
Likes: 0
Received 0 Likes on 0 Posts
Default I have trouble w/ @@identity as well, try

--Assuming you are using in integer field for your PK and that your number increases w/ each entry....

Set NoCount ON

INSERT into tb_table (fieldName) values (@fieldvalue)

Set NoCount OFF

Select Max(PK_field) from tb_table

is that what you are trying to do?
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Snappy79
A7
3
05-04-2015 04:35 PM
forced induction 81
S4 / RS4 (B5 Platform) Discussion
3
01-15-2004 03:14 PM
YS4
S4 / RS4 (B5 Platform) Discussion
4
12-17-2002 08:57 AM



Quick Reply: pagin Matt H: I got a MS Sql question hit me up on AIM when you get this..



All times are GMT -8. The time now is 07:33 PM.