Select Records. Going Crazy.
Apr 29, 2007
Hello,
I have two tables, Articles and Comments, with the following columns:
Articles - [ArticleId] (PK), [ArticleTitle], [ArticleText], [ArticlePubDate]
Comments - [CommentId] (PK), [ArticleId] (FK), [CommentTitle], [CommentText]
I need to display on a web page the articles published during the last week and their comments.
What I need is:
1. Get Articles (DONE)
2. Get Comments for each Article
The solution I see are:
1. Create a Stored procedure that somehow outputs 2 tables:
Articles and Comments associated with those articles
2. Create 2 Stored procedures:
The first one outputs the articles.
The second output all comments given an article ID
In this case, while the data is being displayed on the page it will load the comments for each article.
The problem is that I will have many round trips to the server.
I know how to use (2) but this would give me many round trips to the database.
Could someone help me out with this?
Thanks,
Miguel
View 4 Replies
ADVERTISEMENT
Sep 25, 2006
Hi everyone,
I am new to T-SQL and am trying to do some simple database for fun. Here is my problem and hope you guys can drop me some hint or solution:
OS: Win XP pro
SQL Server 2005 Express
Tool: SQLCMD in command prompt
I created a database and then create a table. Then I tried : select * from contract_Info, it gave me this:
1> CREATE TABLE Contract_Info
2> (
3> Order_No varchar(50) NOT NULL ,
4> Company varchar(255),
5> Product_Name varchar(255) NOT NULL,
6> Discount_Rate varchar(50), --Discount_Rate (%) -> Discount_Rate
7> Status varchar(50) NOT NULL,
8> Quantity varchar(50) NOT NULL,
9> Remainder varchar(50),
10> Deleted bit
11> )
12>
14>
15>
16> INSERT INTO Contract_Info values ('00000', 'DEFAULT','DEFAULT','0','Cancelle
d','0','0',0)
17>
18> go
(1 rows affected)
1> select * from contract_Info
2> go
Order_No Company
Product_Name
Discount_Rate Status
Quantity Rema
inder Deleted
-------------------------------------------------- -----------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------------------------------------------------------------ -------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- -------------------------------------------------- --------------------------
------------------------ -------------------------------------------------- ----
---------------------------------------------- -------
00000 DEFAULT
DEFAULT
0 Cancelled
0 0
0
(1 rows affected)
1>
In SQL Express Management , the output looks perfectly fine
What is missing??
Thanks for your time
View 6 Replies
View Related
Nov 2, 2006
Hello
Im searching for a solution to set all matrix row or cell the same height.
it schoud looks like this example:
This is a simple matrix
test a
text b
text c
text d
text e
text f
text g
This is a matrix with all the same row-height.
test a
text b
.
text c
.
.
text d
text e
text f
text g
.
.
Thx you a lot
View 3 Replies
View Related
Aug 16, 2007
Dear All
I need to cerate a SP that SELECTS all the records from a table WHERE the first letter of each records starts with 'A' or 'B' or 'C' and so on. The letter is passed via a parameter from a aspx web page, I was wondering that someone can help me in the what TSQL to use I am not looking for a solution just a poin in the right direction. Can you help.
Thanks Ross
View 3 Replies
View Related
Aug 6, 2007
SELECT Top 10 Name, Contact AS DCC, DateAdded AS DateTimeFROM NameTaORDER BY DateAdded DESC
I'm trying to right a sql statement for a gridview, I want to see the last ten records added to the to the database. As you know each day someone could add one or two records, how can I write it show the last 10 records entered.
View 2 Replies
View Related
Oct 17, 2007
ok I will post no code this time. I need help I have tried a half of dozen methods and they all only work half way. I need to create a search page that searches on all keywords in a textbox. I have tried split functions, like commands, freetext catalogs.
I want to go with the free text search.
How?
Has anyone used a freetext search in asp or c#? please post some code I re arrange it or let me know how to pass the freetext search param to the sql server.....
Please.....
View 3 Replies
View Related
Oct 5, 2005
Hey all,I need to import an excel file into a SQL table. Users are able to modify and save the excel file. I have a stored procedure that calls a structured storage file which does the import. Both the excel file and the structured storage file reside in the same location. The first time that the stored procedure fires the DTS it works fine, but if the data in the excel file is overwirtten by a user it appears that the import does not function.Am I missing something here?Here is the SPROC:CREATE PROCEDURE [dbo].[importEmployees] AS
DECLARE @object intDECLARE @hr int
--create a package objectEXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUTif @hr <> 0BEGIN print 'error create DTS.Package' RETURNEND
EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile', NULL, 'C:importEmployees.dts', ''IF @hr <> 0BEGIN print 'error LoadFromStorageFile' RETURNEND
EXEC @hr = sp_OAMethod @object, 'Execute'IF @hr <> 0BEGIN print 'Execute failed' RETURNEND
GO
View 1 Replies
View Related
Aug 7, 2001
Hiya!
I have a VB6 app using ADO to connect to SQL Server 7. On one form I am doing two consecutive inserts and I want them to be wrapped in a transaction for integrity. My code looks like this:
connection.errors.clear
connection.begintrans
connection.execute statement 1
connection.execut statement 2
if connection.errors.count > 0 then connection.rollbacktrans else: connection.committrans.
On the BeginTrans line I get the following error:
-2147168227
"Transaction cannot start because more than one ODBC connection is in use". My NativeError is 0, I searched BOL and couldn't find anything informative so I think this is an ADO error only. Also, running sp_who in SQL showed everything was OK. So what's causing this error?
Thanks,
Sarah
View 1 Replies
View Related
Jul 14, 2004
Hi! Have you ever wanted to make life easier? Well, so I am :-)
I have to understand old database ported to ms sql server 2000. Well, the problem is that there are no primary keys at all, no constraints. Database logic is thrown onto triggers and Delphi applications. All fields that should be primary key are in people heads...just mentally :(
Well, you'll say try to find equal fields in different databases... well i was trying to do this. It's impossible...
Any ideas except social engineering?
Thanx
View 3 Replies
View Related
Aug 21, 2007
Hi everyone -
I have two tables, one table (A) that holds a field called location that
has the partial path information of the file
and the second table (B) holds the full path including the filename
I only want to display the records from the partial path (A)
table that do not reside in the second (B) table
Table A =
imagefilename, description, directory, companyname, location
"96.jpg","test","Prog2006_02","Marey, John","Prog2006_0296.jpg"
"274.JPG","disney","Prog2006_07","Amy Gross","Prog2006_07274.JPG"
"570.jpg","sdfsdf","Prog2007_06","Lof3,"Test3","Prog2007_06570.jpg"
"850.JPG","222","Prog2007_08","Malis, Mark","Prog2007_08850.JPG"
Table B =
imagefilename
"d:webdatawebuploadsqfimagesProg2006_0296.jp g"
"d:webdatawebuploadsqfimagesProg2006_03112.p df"
"d:webdatawebuploadsqfimagesProg2006_03127.j pg"
I was thinking about using a cross join with a like condition,
but it fails (go figure)
could someone offer a little help to the query that i need to
perform??
thanks
tony
View 6 Replies
View Related
Feb 6, 2008
Let me please start off by saying if your response to this question is:
"That's retarded! Why are you doing it that way! Do it this way!"
Please refrain from answering my query. With that out of the way, here I go.
I have attached a Sql Server 7.0 db (.mdf and .ldf file) to an instance of MSSQL 2000. When this attach happens, MSSQL2000 automatically upgrades it.
I then detach the db, and place the modified files back into the directory the Server 7.0 instance looks for. Obviously the format of the db files (.mdf and .ldf) have changed following the upgrade. I need to know if there is anything I can do (script or programmatically) to modify the files so that my Sql Server 7.0 instance can read them properly when the engine goes online.
Thank you in advance for any tidbits you can provide
View 7 Replies
View Related
May 9, 2008
Hi,
Is this at all possible to do. I have been stuck for a couple of hours trying.
SELECT DISTINCT ItemTag,
ItemBinLocation
FROM VInventory
WHERE
(
SELECT
CASE x
WHEN 'x'
THEN (LEFT(ItemBinLocation, 1) = 'abc'
WHEN 'y'
THEN LEFT(ItemBinLocation, 3) = 'efg'
END
FROM dbo.OtherTable
)
???
I need some Yak Milk please!
View 1 Replies
View Related
Sep 18, 2006
I keep getting this stupid error, if
any of you have time to kill and could look at this I would really appreciate
it.
This checks for a login in the
database and if it already exists it makes it unique.
In the error message, €˜ssewell504€™
was the value returned after the proc ran, the last 3 digits will be different
each time it€™s ran.
Thanks guys and take
care!Here's the error:
"Syntax error converting the varchar value 'ssewell504' to a column of datatype int"
ALTER proc
[dbo].[spx_CONS_CheckLoginUnique]
(
@SourceLogin varchar(25) = 'ssewell',
@TargetLogin varchar(25) = 'ssewell'
)
as
begin
declare @ReturnedValue int
declare @AlreadyInUse int
declare @AppendedValue varchar(3)
declare @Range int
set @Range = 999
set @AlreadyInUse = 1 -- set flag
--if target login and source login are
the same...we need to change target
login
if @SourceLogin =
@TargetLogin
begin
while @AlreadyInUse = 1 -- this stays eq to 1 until target login
is unique in DB
begin
Set @ReturnedValue = CONVERT(int, (@Range+1)*Rand()) -- get random
num
Set @AppendedValue = CAST(@ReturnedValue as varchar(3)) -- cast value to
varchar
set @TargetLogin =
@TargetLogin + @AppendedValue --
append to target login
--if by chance this login is already in
there(taken), keep going until it's
not
if EXISTS(select Login_Name from dbo.SECR_Login where Login_Name =
@TargetLogin)
begin
set @AlreadyInUse = 1
--set flag to keep
looping
end
else
begin
set
@AlreadyInUse = 0 --set flag to exit out of loop, our login is now
unique
end
end
end
return
@TargetLogin
end
View 3 Replies
View Related
Aug 17, 2005
I have an unusual problem. I am using VB.Net 2003 and sqlexpress using .NET dataset to insert records into an timecards table. After inserting several records I tried a 'Select * from timecards' and the inserted records where not selected. if I 'select * from timecards order by employee' ( or any other field) the inserted records are selected! The table was created by an Access Upsize command.
Any suggestions?
Thanks!
GordonG
View 13 Replies
View Related
Mar 5, 2004
I posted this scenario earlier and ndinakar said my code worked on (I guess) his own machine but has not worked on mine! Does that not sound funny? I need to ge through with this simple but frustrating stuff in time. I've implemented more complex snippets before this but I just can't figure the problem out.
Can anyone out there tell me what I could be doing wrongly? I wrote a simple stored procedure called 'proc_insert_webuser' in a database that has been moved to a remote server called LAGOS-NTS3. I executed it from SQL Query Analyser and it worked. When, however, I executed the same stored procedure from ASP.Net it gives an impression that a new record has been inserted and even displays the newly generated ID column to me. On checking the base table I found only blank columns with only the ID column having the generated IDs!
I'm perplexed. I checked the code and can't possibly spot the error. Can anyone help. Found below are snippets used.
CREATE PROCEDURE proc_insert_webuser
(
@applicantidnumeric(18) output,
@firstnamevarchar(18),
@midname varchar(18),
@lastname varchar(50),
@secretcodevarchar(18),
@my_errnumeric(18) output
)
AS
IF (SELECT COUNT(ApplicantID) FROM tbl_webuser WHERE Firstname = @firstname AND Midname = @midname AND Lastname = @lastname) = 0
BEGIN
begin transaction
INSERT INTO tbl_webuser (Firstname, Midname, Lastname, SecretCode)
VALUES (@Firstname, @Midname, @Lastname, @SecretCode)
commit transaction
SET @applicantid = @@IDENTITY
END
ELSE
BEGIN
RAISERROR('Error! Execution aborted. A matching user profile exist.', 16, 1)
SELECT @my_err = @@ERROR
END
RETURN
Then the ASP.Net stuff:
Sub PostData()
'connection string production
Dim cstring As String = "User ID = sa; Password = ; database = E-Recruitment; Server = LAGOS-NTS3; Connect Timeout = 60"
'connection instantiation
Dim cnx As SqlConnection = New SqlConnection(cstring)
Try
'open connection
cnx.Open()
'instantiates and execute a command object
Dim cmd As SqlCommand = New SqlCommand
With cmd
.Connection = cnx
.CommandText = "proc_insert_webuser"
.CommandType = CommandType.StoredProcedure
Dim param1 As New SqlClient.SqlParameter("@applicantid", 0)
param1.DbType = DbType.Single
param1.Direction = ParameterDirection.Output
.Parameters.Add(param1)
Dim param2 As New SqlClient.SqlParameter("@firstname", txtFirstNM.Text)
param2.DbType = DbType.String
param2.Direction = ParameterDirection.Input
.Parameters.Add(param2)
Dim param3 As New SqlClient.SqlParameter("@midname", txtMidNM.Text)
param3.DbType = DbType.String
param3.Direction = ParameterDirection.Input
.Parameters.Add(param3)
Dim param4 As New SqlClient.SqlParameter("@lastname", txtLastNM.Text)
param4.DbType = DbType.String
param4.Direction = ParameterDirection.Input
.Parameters.Add(param4)
Dim param5 As New SqlClient.SqlParameter("@secretcode", txtPWD.Text)
param5.DbType = DbType.String
param5.Direction = ParameterDirection.Input
.Parameters.Add(param5)
Dim param6 As New SqlClient.SqlParameter("@my_err", 0)
param6.DbType = DbType.Single
param6.Direction = ParameterDirection.Output
.Parameters.Add(param6)
.ExecuteNonQuery()
'pick the auto-number
Dim strAppID = .Parameters("@applicantid").Value
'notifies the user of record success
lblMessage.Text = "Profile created. Your ApplicantID is : " & strAppID & " Kindly take note of your UserID. You'll need it for future logins."
End With
Catch ex As Exception
'notifies the user of any error(s)
lblMessage.Text = Err.Description & " originating from " & Err.Source
Finally
cnx.Close()
End Try
End Sub
==================
I'm calling this procedure from the click event of a command button. What could be happening to the code? I have done similar things and got positive results! Any hint from anyone out there?
View 6 Replies
View Related
Aug 29, 2001
Hi
I have and issue with a query, I tried every thing but I couldn't find why. Here is the issue, I have one big DB1 with about 30 tables, the query based on a join of 5 tables, I have the right index in place, when I run the query it will take about a minute and 20 sec. But I have another DB2 on the same server and I imported just the 5 tables form DB1 with the same index, when I run the same query it will take 6 seconds.
I did drop and recreate the indexes and drop and recreate the statistics but still the same thing no difference.
I'm running SQL7 SP3.
Do you have any idea what might be the issue here?
Thanks for your help
View 4 Replies
View Related
Oct 5, 2006
Hi all,
I am having a serious problem developing my reports within VS2005. For no reason, on one of my report it seems the parameters have got a life of there own.
There is a collection of 4 parameters whose values change randomly (internal, hidden, multivalue). Regardless of what I set them to, once I click save some change, when I alter 1 parameter, the values of one of the other parameters change while the settings for the parameter I changed to not apply.
What is going on here, I have been developing reports without issue however this is becoming a major concern. Please help!
Kind regards
Taz
View 2 Replies
View Related
Nov 29, 2007
Hi Guys, I have a syntax error in my SQL SELECT Query that is driving me crazy. All I am doing is adding a conditional with a literal value and that is breaking the query.This Query Works: SELECT
Quantity,
CAST(Gallons AS VARCHAR(10)) + ' ' + Style,
Colour
FROM
ORDER_TANK_LINK
LEFT JOIN TANKS
ON TANKS.TankID = ORDER_TANK_LINK.TankID
LEFT JOIN COLOURS
ON COLOURS.ColourID = ORDER_TANK_LINK.ColourID
This One is Broken:SELECT
Quantity,
CAST(Gallons AS VARCHAR(10)) + ' ' + Style,
Colour
FROM
ORDER_TANK_LINK
ON ORDER_TANK_LINK.OrderID = 1
LEFT JOIN TANKS
ON TANKS.TankID = ORDER_TANK_LINK.TankID
LEFT JOIN COLOURS
ON COLOURS.ColourID = ORDER_TANK_LINK.ColourID
Obviously I haven't explained the design of the tables, but because of the fact that I have another query that is so similar working perfectly, I didn't think you'd need it.
The exact error is "Incorrect Syntax Near the Keyword 'ON'". OrderID is definately a value of the ORDER_TANK_LINK Table and is of type int.
Thanks in advance!
View 4 Replies
View Related
Apr 16, 2008
I'm trying to do a basic update query which is working on other pages but not on this page. Dim uid As Integer = CInt(Session("uid"))
Dim cmd As New SqlCommand("UPDATE [cvdata] SET [jobCompanyName] = @inputJobCompanyName WHERE [user_id] = @uid", strConn)
With cmd.Parameters
cmd.Parameters.AddWithValue("@inputJobCompanyName", inputJobCompanyName.Text)
cmd.Parameters.AddWithValue("@uid", uid)
End With
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
The funny thing is that if i remove inputJobCompanyName.Text and add a custom value (for example "test") it works.So it doesn't seem to read my updated textfield or something im clueless.Kind regards,
Mark
View 2 Replies
View Related
Jul 17, 2007
First; thanks for looking.
On SQL Server 2000. IBM X series, dual 2GHz Xeon processors, 3GB RAM, RAID 5 DB array and separate Mirrored drive for OS, Windows 2000 Server.
Note: I should have moved the log files to the mirrored volume - I only just noticed it wasn't like that ... oops.:o It only has the OS and backup files (different logical volumes).
Problem: I have a Bill of Material system. It has a batch (Stored Procedure) that explodes Order Line Items. Each line has about 40 components.
The SP has 5 major steps to explode the Assembly, figure out colors/sizes to get the actual part numbers, assign quantities, update flags on the line item table (that has 3,500,000 rows but is not a clustered index - fill factor 85% on the unique autonumber index I use for the updates). The SP is jam packed with User Function calls, sub-Stored Procedures, and (yes) some cursors (on small declared temp tables created for each Order Line processed).
The execution plan for the whole batch of 100 is humongous - like 1000 pages, however nearly all steps are about 16 - 40 milliseconds to execute.
It normally takes 13 seconds to process 100 line items (3900 assembly rows created). However; about every 20th run, it takes 2 or 3 minutes ON THE VERY SAME LINE ITEMS. No programming changes! Run back-to-back, or with a minute or two delay. Then running it again, back to 13 seconds. Sometimes it takes 25 or so seconds, but that oddball 3 minutes is a killer.
I put some timing INSERTs into a temporary log file to localize the problem.
So; here's the REALLY weird thing. The part that experiences the intermittent 2 minute delay is a VERY SIMPLE call to a SP that INSERTs to the tbBATCHs table and gets the identity and passes it back with an Output variable. The tbBATCHs table only has about 8 columns. Nobody else uses it so it's not locking. It has an "If Exists" selection following the Insert to see if another batch is in progress not yet flagged as complete, but's not the issue because it's never true (hard coded values for testing forces this).
I have a Standby Server (duplicate config of main server) so I ran it there. Same issue.
If I loop 100 times on the tbBATCHs INSERT SP, it is pretty quick (like 2 seconds for all 100).
It's never on the first run, so I think it may be some sort of Log File catch-up.
Also; I DO NOT have Transaction Logging in place yet.
Ideas?
View 5 Replies
View Related
May 29, 2008
I need some serious help with this query...
SELECT *
FROM dbo.wce_contact
WHERE (Mail1Date IS NOT NULL)
AND (Mail2Date IS NULL)
AND (Mail3Date IS NULL)
AND (Mail4Date IS NULL)
AND (Mail5Date IS NULL)
AND (Mail6Date IS NULL)
AND (Mail7Date IS NULL)
AND (Mail8Date IS NULL)
AND (Mail9Date IS NULL)
AND (Mail10Date IS NULL)
AND (Mail11Date IS NULL)
AND (Mail12Date IS NULL)
AND (Mail14Date IS NULL)
AND (Mail15Date IS NULL)
AND (Mail16Date IS NULL)
or(IDStatus LIKE '')
or (NOT (Task LIKE '%x%'))
or (ExpressEmail LIKE '%@%')
or (WebSite NOT LIKE '')
or (Unsubscribe = 0)
or (Artwork LIKE '')
Basically the parts in red work best when they use the 'or' criteria.
My problem.
I run the query together black+red and get a different result than expected. Is there a way of saying 'do the black part first and its an imperative that the red part follows those rules on the black part of the query?' eg:
IDStatus must be LIKE '' when running the black part of the query
and expressemail must be like '%@%' on the black part of the query but not on red part of the query. So it doesnt matter that the expressemail must have idstatus like '' whilst having an @
Hope it makes sense??
View 11 Replies
View Related
Nov 16, 2006
Hi,
I have created a new user in my database called "acm", I also created a new schema called "acm" as well, the "acm" user is its owner, and the default schema for "acm" user is the "acm" schema.
I also created a login called "acm" (surprise surprise) and set its default database to "mydb" database.
In "mydb" database I have a table "mytable" that is owned by "acm". In my connection string I am using "acm" as the user, but when I do:
"select * from mytable" I get error ("bla bla object bla bla"), when I use "acm" as a prefix for the table name it works fine... What do I miss??
My connection string is:
Data Source=.SQLEXPRESS;AttachDbFilename="C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAccountManagerDb.mdf";Persist Security Info=True;User ID=acm;Password=acm;Connect Timeout=30;User Instance=False
Thanx,
Yuval.
View 7 Replies
View Related
Feb 19, 2008
I take it SSCE 3.5 only runs under .Net 3.5? My project was updated from VS05 to VS08 but the target is still .Net 2.0 would this be why I cant use the SQLCE namespace.
Forgive me for being noobalishous but I have been thinking that SSCE 3.5 would be a great solution for my app as I want to be able to use SQL Server Express 2005 and some other Local DB system (SSE is too bulky for my app when networking is not required). But if the prereq is that the client must have .Net 3.5 installed then I am back to square 1 because .Net 3.5 is like 195Mb install (which i tried installing as a prereq on my friend's Vista Ultimate(?) machine yesterday and it crashed it). Aaargh!! How are you supposed to develop small DB apps (3.5Mb max for app footprint) in the VS environment that don't require massive installation prereqs???
Dont get me wrong I love VS but surely there has to be a way to minimise prereq overheads.
View 5 Replies
View Related
Sep 22, 2007
I built a new computer which has intel e6750 core duo 2.66 GHZ cpu. Firstly I installed windows XP with sp2 and installed whole patches.Then install Microsoft office 2007 and install microsoft visual studio 2005 I got an error with sql express 2005 like below: And After I install windows XP again. with no patches first ı install VS2005 but got same error. Then I change my windows release, I install windows XP with SP1 then I tried but got same error. I tried to install seperate sql server express file but same error. is it about my hardware or what? Please response as soon as possible? Thanks.
TITLE: Microsoft SQL Server 2005 Setup
------------------------------
The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually."
For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.06&EvtSrc=setup.rll&EvtID=29503&EvtType=sqlsetuplib%5csqlservice.cpp%40Do_sqlScript%40sqls%3a%3aSqlService%3a%3aStart%40x2
------------------------------
BUTTONS:
&Retry
Cancel
View 1 Replies
View Related
Aug 30, 2006
A basic select statement to be used.
View 3 Replies
View Related
Sep 19, 2006
This one isn't so simple.I have a list of training modules, training complete dates and a list of employees in separate tables. I'll give an good example in a second. The problem I am having is that I need to generate a select statement that will generate a kind of 'spreadsheet' that will list the employees in the rows, and columns containing the results in the fields (the training module may or may not have been completed, and thus may or may not be in the result box. I think the example explains it fairly well (note, I did not design the database structure but have to work with it).Employees table:empNameJane DoeAlton BrownJohn DoeTrainingCourse table:courseNameWeldingBrain SurgeryScuba DivingResults table:empName: courseName: completeDate:Jane Doe Welding 2/2/2002Jane Doe Brain Surgery 3/7/2005Alton Brown Scuba Diving 9/23/2004Alton Brown Welding 11/4/2004John Doe Brain Surgery 6/14/2003End result of select statement: Welding Brain Surgery Scuba DivingJane Doe 2/2/2002 3/7/2005 Alton Brown 11/4/2004 9/23/2004John Doe 6/14/2003 Thanks a million to anyone with insight into this. I'm still trying to figure out a way to do this, but after a few days haven't come up with or found anything. Most things I've found online are too simplistic.
View 8 Replies
View Related
Feb 2, 2006
Is it just me, or are features missing in Management Studio? I mean, where is the "Export Objects" option when exporting data? Why is it so difficult to register a remote server? Why do the object views suck? And most important, why is the documentation the worst software documentation I have EVER SEEN?!
Things that were easy in Enterprise Manager with Client Network Utility and Query Analyzer seem impossible, difficult, or maybe just hidden in Management Studio. If it is there, the documentation sure doesnt tell you how to find it.
Please someone tell me that it's just me. Tell me that the features are there but Im not doing something right. I feel like putting my head in between my door opening and banging the door against it.
View 2 Replies
View Related
Apr 30, 2007
Hello,I am selecting some articles and some comments related with it:SELECT a.ArticleID, a.Title, a.Content, c.CommentId, c.Title, c.Comment, u.UserName AS ArticleAuthorName, u.UserEmail AS ArticleAuthorEmailFROM Articles aINNER JOIN Users u ON a.AuthorID = u.UserIDINNER JOIN Comments c ON a.ArticleID = c.ArticleIDI have 2 problems which I am trying to solve:1. Comments table also have an AuthorId So for each comment I also want to join to Users table and get the author name and email. How can I do this?2. I want to select all Articles even if it has comments or not. Can I use Inner Join or should I use Left Join? Is Outer Join still available in SQL 2005?Thank You,Miguel
View 2 Replies
View Related
Jul 14, 2007
Hi there,
I'm new to SQL.
I have encoutered a problem, I know how to select top 10 records from the database, but what about 11-20?
I can't use
Quote:
View 3 Replies
View Related
Jan 12, 2006
I have a simple table something like this
ID First Last
1 Bob Hope2 Charles Draw3 Mark Andrews
Etc, etc
I need the SQL statement select the last 10 records in the table, so if the highest ID id 82 I need all fields of records with ID 72-82
Help appreciated, i'm sure it must be simple enough buy mind is blank.
thanks
View 1 Replies
View Related
Jul 14, 2007
Hi there,
I'm new to SQL.
I have encoutered a problem, I know how to select top 10 records from the database, but what about 11-20?
I can't use
Quote: SELECT TOP 10 * FROM table WHERE id > 10
because even though my ID is auto numbered, but I have deleted some entries.
Does anyone have good solutions?
p.s I tried this and doesn't work either
Quote: SELECT TOP 10 * FROM table WHERE id IN(SELECT TOP 20 * FROM table ORDER by date DESC) ORDER BY date ASCENDING
TIA
-noPcz
View 5 Replies
View Related
Aug 16, 2005
Stijn writes "Hello,
I have SQL 7 with WINDOWS 2000 SERVER
My problem is that i am looking for a script
my db is for equipement inventory
how can i select all the records from a room,
if this room (room1)has less of 100 records he needs te go to the follow room(room2), en the next room until he's got 100 records,
sorry for my english"
View 2 Replies
View Related
Aug 18, 2005
Mack writes "I want to select last 2 records from a table AA which has following 5 records.
111
222
333
444
555
There is no primary key.
Any tip will be really appretiated.
Thanks for taking time to read it."
View 2 Replies
View Related