Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Microsoft SQL Server: Programming | Forum profile

Forum profile page for Microsoft SQL Server: Programming on http://www.tek-tips.com. This report page is the aggregated overview from a single forum: Microsoft SQL Server: Programming, located on the Message Board at http://www.tek-tips.com. This forum profile page summarizes the general forum statistics such as: Users Activity, Forum Activity, and Top Authors, which are reported in either a table or graph below for a given reporting time period. Additional forum profile information for "Microsoft SQL Server: Programming" on the Message Board at http://www.tek-tips.com is also shown in the following ways:

1) Latest Active Threads
2) Hot Threads for Last Week

Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a forum's popularity and/or exact posting volumes at any given reporting period.

Site: Tek-Tips Forums - Microsoft SQL Server: Programming (site profile, domain info tek-tips.com)
Title: Microsoft SQL Server: Programming
Url: http://www.tek-tips.com/threadminder.cfm?pid=183
Users activity: 36 posts per thread
Forum activity: 65 active threads during last week
 

Posting activity on Microsoft SQL Server: Programming:

  Week Month 3 Months
Threads: 65 229 709
Post: 244 818 2,517
 

Microsoft SQL Server: Programming Posting activity graph:

Posts by:  day  week  month 

Top authors during last week:

Name
Posts
markros
75
user's latest post:
Max Date
Published (2009-11-07 23:55:00)
Try CODE select S.StudentID,        Min(Review1) as Review1,        case when min(Review1) = Max(Review1) then NULL else Max(Review1) end as Review2 FROM WBLP
gmmastros
34
user's latest post:
duplicate records ... sort of
Published (2009-11-06 16:53:00)
First, forget about all the other columns.  Get the rows where there are duplicate Id's. CODE Select this_ID From   YourTable Group By this_ID Having Count(*) > 1 Next, make this a derived table to get your results. CODE Select YourTable.* From   YourTable        Inner Join (...
bborissov
19
user's latest post:
join query help?
Published (2009-11-06 12:08:00)
Using [*] as field list is BAD! I doubt you ALWAYS need all fields from table(s). Use just needed fields in the queries. Also HOW you will join these tables? What is the common field between them? And how do you know if the some customers is still active, or it is enough to have a record in Orders Table for them? What if the last date in that table is 01 Jan 1432? Borislav Borissov VFP9 SP2, SQL Server 2000/2005.
jadams0173
13
user's latest post:
Data manipulation parent/child
Published (2009-11-06 13:30:00)
Almost...but not quite. here is what I got when I ran your query. All the Parents repeat. I was hoping for one Parent and then all the children under that parent. It also almost looks like something is duplicating.  I'm going to verify that my data doesn't have duplicates in it.   CODE PARENT       1081074001411C...
misscrf
12
user's latest post:
View same table from all databases?
Published (2009-11-06 14:58:00)
This is the code I am working on. CODE SET NOCOUNT ON DECLARE @sql nvarchar(max) SET @sql = 'alter view vw_ABC as ' +'' SELECT @sql = @sql  + ' select ''[Server1].'+''+Name+''' as DatabaseName,E.Directory, E.Title, E.Created, E.WorkStation, E.Status, E.ItemCount, E.ItemTotal, E.RecordsWritten, E.Errors, E.Excluded, E.PartiallyExcluded, E.Incomplete, E.Size FROM...
kylua
7
user's latest post:
Update using value from another...
Published (2009-11-04 11:04:00)
Yes, I'm using it in SQL Server Management Studio. Haven't tried it from an asp.net script, I was testing it in the 'natural' environment first. Run it thru asp.net just now: Corrected a coupla C&P errors and it works! Thank you Markros!  You've just taught me how to do a multi-joined update query and not to trust what Microsoft products tell me! Have a star!
1DMF
7
user's latest post:
Unique records using replace...
Published (2009-11-04 08:11:00)
r937, let me know when you have clarified who's right. I like the idea Celko is suggesting very much, but would appreciate confirmation if this is the case or not. All I know is it works on mySQL and not MS SQL! Is that because mySQL is more standards compliant or less because it's allowing something that isn't in the standard? Is this another case of MS and standards, or a case of their being different standards that no-one...
jbenson001
7
user's latest post:
US Medical HCPC / CPT Codes
Published (2009-11-05 11:27:00)
Looks like you will have to buy the codes.  And it seems they may change and be updated often, so I doubt you are going to get the info for free.
sap1958
6
user's latest post:
eliminsting both rows if one row...
Published (2009-11-06 13:52:00)
I have a query: select phnID,phnumber from phone where phnRest not in ('1','2','3') Here is some sample data phnID    phnumber  phnRest 1         3239055   5   (shows up)...
LAM986
6
user's latest post:
Max Date
Published (2009-11-07 13:42:00)
One more question.  How do I handle if Review1 is NULL So the data looks like: StudentID   Review1     Review2 228017     12/30/2008    NULL...
 

Latest active threads on Microsoft SQL Server: Programming::

Tek-Tips Forums
Started 1 day, 11 hours ago (2009-11-09 02:06:00)  by bborissov
When the single quote is inside the string just double it So if you want something like: "I don't know" as a result you should use: CODE SELECT 'I don''t know' If you send string from your BackEnd, instead of building the whole query as a single string use parameters. The Provider or ODBC driver can handle it. Borislav Borissov VFP9 SP2, SQL Server 2000/2005.
Thread:  Show this thread (8 posts)   Thread info: Need advice about handling "characters" in MSSQL Size: 546 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Need advice about handling "characters" in MSSQL :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 23 hours, 59 minutes ago (2009-11-09 13:47:00)  by markros
Why you're joining by so many fields? Also, for better maintenance, can you use JOIN instead of WHERE. For your case you may try join on all the fields and (AND tbltrade.[Operator_ID] = [tbltrade_reg_dept_Outages].[Operator_ID] or (tbltrade.[Operator_ID] IS NULL and [tbltrade_reg_dept_Outages].[Operator_ID] IS NULL))
Thread:  Show this thread (2 posts)   Thread info: Update with Join that has null values Size: 411 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Update with Join that has null values :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 1 day, 1 hour ago (2009-11-09 11:54:00)  by genomon
Why not post as a FAQ? Cogito eggo sum – I think, therefore I am a waffle.
Thread:  Show this thread (2 posts)   Thread info: Refresh All Database Views Size: 169 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Refresh All Database Views :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 1 day, 3 hours ago (2009-11-09 10:43:00)  by gmmastros
Your code will have CR/LF in it. When you run the code above in a query window, you will not SEE the carriage return, line feeds because you are running in 'GRID' mode. If you change your mode to 'text' you will see it. Right click the query window. Click Results To -> Results To Text Run the query again and you will see multiple lines. - George "The great things about standards is ...
Thread:  Show this thread (2 posts)   Thread info: Creating sql code within sql - carriage return - line feed Size: 702 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Creating sql code within sql - carriage return - line feed :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 1 day, 3 hours ago (2009-11-09 10:01:00)  by markros
What is your version of SQL Server? In your update command you're missing GROUP BY, but I'm not sure how exactly you want to group by. Alternatively, you may want to first grab information into cte using select statement and then update.
Thread:  Show this thread (3 posts)   Thread info: Update statement error Size: 305 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Update statement error :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 4 days, 15 hours ago (2009-11-05 22:11:00)  by markros
select S.StudentID, Min(Review1) as Review1, Max(Review1) as Review2 from WBLP would this work?
Thread:  Show this thread (14 posts)   Thread info: Max Date Size: 163 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Max Date :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 3 days, 20 hours ago (2009-11-06 16:53:00)  by gmmastros
First, forget about all the other columns. Get the rows where there are duplicate Id's. CODE Select this_ID From YourTable Group By this_ID Having Count(*) > 1 Next, make this a derived table to get your results. CODE Select YourTable.* From YourTable Inner Join ( Select this_ID From YourTable Group By this_ID Having Count(*) > 1...
Thread:  Show this thread (2 posts)   Thread info: duplicate records ... sort of Size: 1,350 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: duplicate records ... sort of :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 3 days, 21 hours ago (2009-11-06 16:33:00)  by chapuchi30
use the inner join sentence, something like select a.id,b.members from table1 a inner join table2 b on a.members=b.id
Thread:  Show this thread (5 posts)   Thread info: Parse String Size: 185 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Parse String :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 1 week, 1 day ago (2009-11-02 12:55:00)  by markros
IMHO, you need here to use dynamic SQL and loop through the result of the first query to construct it.
Thread:  Show this thread (30 posts)   Thread info: View same table from all databases? Size: 157 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: View same table from all databases? :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Tek-Tips Forums
Started 3 days, 23 hours ago (2009-11-06 14:09:00)  by gmmastros
Try this: CODE Select phone.phnId, phone.phNumber From phone Left Join ( Select phnId From phone Where phnRest In (1,2,3) ) As A On phone.phnId = A.phnId Where A.phnId Is NULL If this works, and you would like me to explain it, just let me know. - George "The great things about standards is that there are so many to choose from." ...
Thread:  Show this thread (3 posts)   Thread info: eliminsting both rows if one row meets condition - sql 2005 Size: 1,025 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: eliminsting both rows if one row meets condition - sql 2005 :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
 

Hot threads for last week on Microsoft SQL Server: Programming::

Microsoft SQL Server: Programming
Started 1 week, 1 day ago (2009-11-02 12:55:00)  by markros
IMHO, you need here to use dynamic SQL and loop through the result of the first query to construct it.
Thread:  Show this thread (30 posts)   Thread info: View same table from all databases? Size: 157 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: View same table from all databases? :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 5 days, 4 hours ago (2009-11-05 09:18:00)  by markros
CODE SELECT * FROM ( SELECT RELATIONSHIP, ASSY = CASE N WHEN 1 THEN "Parent" WHEN 2 THEN "Child" --WHEN 3 THEN Col3 --WHEN 4 THEN Col4 END FROM V_Parent_Child_EDS T CROSS JOIN ( SELECT 1, 'PARENT' UNION ALL SELECT 2, 'CHILD' ) X (n, RELATIONSHIP) ) Z WHERE ASSY <> '' group by Relationship, Assy
Thread:  Show this thread (29 posts)   Thread info: Data manipulation parent/child Size: 893 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Data manipulation parent/child :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 1 week, 1 day ago (2009-11-02 05:09:00)  by bborissov
CODE SELECT REPLACE(REPLACE(version,' (Global)',''),' (Local)','') AS myversion, COUNT(1) AS Cnt FROM grank WHERE ((position > 0 AND position <= 100) AND refdate BETWEEN '20091027' AND '20091102') GROUP BY REPLACE(REPLACE(version,' (Global)',''),' (Local)','') Borislav Borissov VFP9 SP2, SQL Server 2000/2005.
Thread:  Show this thread (15 posts)   Thread info: Unique records using replace -> group by not working Size: 573 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Unique records using replace -> group by not working :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
RE: Max Date - 14 new posts
Started 4 days, 15 hours ago (2009-11-05 22:11:00)  by markros
select S.StudentID, Min(Review1) as Review1, Max(Review1) as Review2 from WBLP would this work?
Thread:  Show this thread (14 posts)   Thread info: Max Date Size: 163 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Max Date :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 1 week ago (2009-11-03 10:59:00)  by markros
SQL Server 2005 and up solution - not tested CODE select * from (select Field, count(*) over (partition by substring(Field, 1, LEN(Field)-2)) as CntUnique from myTable) X where CntUnique %2 = 1 -- Odd number of items (assuming we always have one with +C and one with +O - if we may have 2 +C and 1 +O the query would not work
Thread:  Show this thread (13 posts)   Thread info: Compare same field in same table Size: 445 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Compare same field in same table :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 6 days, 15 hours ago (2009-11-03 21:51:00)  by gmmastros
Your problem is here: CODE SET @CountDeleted = @CountDeleted + 500 IF @@ROWCOUNT < 1 GOTO delete_more1_skip Setting the value of a variable will affect the row count. In fact, the @@RowCount will ALWAYS be one here. To fix this problem, declare another variable and select the @@RowCount in to this variable. - George "The great things about standards is that there are so many to ...
Thread:  Show this thread (12 posts)   Thread info: Having a logic issue with IF @@ROWCOUNT Size: 747 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Having a logic issue with IF @@ROWCOUNT :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 6 days, 3 hours ago (2009-11-04 09:55:00)  by r937
SELECT *, 'E01_ACNT' as tablename FROM E01_ACNT UNION ALL SELECT *, 'N01_ACNT' FROM N01_ACNT UNION ALL ... SELECT *, 'Z01_ACNT' FROM Z01_ACNT r937.com | rudy.ca Buy my new book Simply SQL from Amazon
Thread:  Show this thread (10 posts)   Thread info: Pass through query selecting multiple tables with same structure ... Size: 540 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Pass through query selecting multiple tables with same structure ... :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 1 day, 11 hours ago (2009-11-09 02:06:00)  by bborissov
When the single quote is inside the string just double it So if you want something like: "I don't know" as a result you should use: CODE SELECT 'I don''t know' If you send string from your BackEnd, instead of building the whole query as a single string use parameters. The Provider or ODBC driver can handle it. Borislav Borissov VFP9 SP2, SQL Server 2000/2005.
Thread:  Show this thread (8 posts)   Thread info: Need advice about handling "characters" in MSSQL Size: 546 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Need advice about handling "characters" in MSSQL :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 1 week, 4 days ago (2009-10-30 12:17:00)  by RiverGuy
Your query is missing a FROM clause CODE update sheets set TimeSheetData.total = TimeSheetData.hours * positions.rate from sheets inner join staff ON TimeSheetData.staff = staff.ID inner join positions ON staff.rate = positions.ID where Processed = 0 Although it seems odd that you would be joining the Staff.rate to Positions.ID
Thread:  Show this thread (14 posts)   Thread info: Update using value from another table Size: 514 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Update using value from another table :: Microsoft SQL Server: Programming :: Tek-Tips Forums"
Microsoft SQL Server: Programming
Started 5 days, 5 hours ago (2009-11-05 08:23:00)  by gmmastros
You have bigger problems than a datetime conversion. Your trigger assumes that a single row is being inserted/updated. If multiple rows are inserted or updated within the same query, your procedure will only handle one row. This will likely cause problems with your data. I strongly encourage you to fix this issue as soon as possible. - George "The great things about standards is that ...
Thread:  Show this thread (7 posts)   Thread info: Problem with datetime in trigger Size: 688 bytes
Related Threads: Same Site | All Sites
Customize:  Customize "RE: Problem with datetime in trigger :: Microsoft SQL Server: Programming :: Tek-Tips Forums"