sql-server-2005 Questions
3
Solved
Can I name a custom column in the SELECT statement and reference that in the WHERE clause without duplicating code?
For example;
SELECT RIGHT(REPLICATE('0', 5) + RTRIM(SOME_ID)), 5) AS DISPLAY_ID...
Textile asked 1/4, 2010 at 17:48
10
Solved
SELECT logcount, logUserID, maxlogtm
, DATEDIFF(day, maxlogtm, GETDATE()) AS daysdiff
FROM statslogsummary
WHERE daysdiff > 120
I get
"invalid column name daysdiff".
Maxlogtm is a datet...
Fatten asked 3/12, 2011 at 18:57
22
Solved
When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that is 2011-02-25. How can I do this?
Flounce asked 26/2, 2011 at 7:17
5
Solved
Is it possible to convert text from a table column in SQL Server to PascalCase only using a proper SQL code?
TABLE DEFINITION
----------------------
ID int
CITTA varchar(50)
PROV varchar(50)
CAP v...
Vibratory asked 8/12, 2010 at 0:14
7
Solved
I have recently been running into many different areas of SQL Server that I normally don't mess with. One of them that has me confused is the area of Logins and Users. Seems like it should be a pre...
Unprincipled asked 15/7, 2009 at 21:55
34
Solved
I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE...
Bergman asked 9/10, 2008 at 0:50
15
Solved
Running the following query in SQL Server Management Studio gives the error below.
update table_name set is_active = 0 where id = 3
A severe error occurred on the current command. The results,...
Granddaddy asked 24/7, 2009 at 0:34
16
I want to return top 10 records from each section in one query. Can anyone help with how to do it? Section is one of the columns in the table.
Database is SQL Server 2005. I want to return the top...
Marchpane asked 7/10, 2008 at 2:1
3
Solved
How to select records between a date to another date given a DateTime field in a table.
Omniumgatherum asked 22/12, 2009 at 11:10
30
Solved
The last few days we see this error message in our website too much:
"Timeout expired. The timeout period
elapsed prior to obtaining a
connection from the pool. This may
have occurred because...
Scavenger asked 22/3, 2009 at 9:50
9
Solved
How do I convert hh:mm:ss to hh:mm in SQL Server?
select Count(Page) as VisitingCount,Page,CONVERT(VARCHAR(8),Date, 108) from scr_SecuristLog
where Date between '2009-05-04 00:00:00' and '2009-05...
Dachshund asked 4/5, 2009 at 13:42
10
Solved
I was debugging a stored procedure the other day and found some logic something like this:
SELECT something
FROM someTable
WHERE idcode <> (SELECT ids FROM tmpIdTable)
This returned nothin...
Pelargonium asked 13/5, 2009 at 14:38
8
Solved
I'm having a similar issue to The current transaction cannot be committed and cannot support operations that write to the log file, but I have a follow-up question.
The answer there references Usi...
Chasseur asked 20/9, 2011 at 15:59
45
Solved
How can I add a column with a default value to an existing table in SQL Server 2000 / SQL Server 2005?
Helvetian asked 18/9, 2008 at 12:30
11
"Adaptive Server is unavailable or does not exist" error connecting to SQL Server from PHP
I'm attempting to connect to a SQL Server 2005 DB from my Mac using unixODBC and FreeTDS as I have outlined here. However, when I try to connect in to a different DB using the same setup, I get:
C...
Chiffchaff asked 14/12, 2011 at 20:42
7
I have a table with around 20 columns. Aside from typing out:
Where column1 is null OR column2 is null OR column3 is null etc...
Is there a quicker way to just check every column and see if any...
Mick asked 14/3, 2012 at 15:54
19
Solved
I need to update this table in SQL Server with data from its 'parent' table, see below:
Table: sale
id (int)
udid (int)
assid (int)
Table: ud
id (int)
assid (int)
sale.assid contains the cor...
Gracchus asked 18/8, 2009 at 11:40
20
Solved
I created a database on my local machine and then did a backup called tables.bak of table DataLabTables.
I moved that backup to a remote machine without that table and tried to do a restore but g...
Thevenot asked 11/8, 2011 at 19:35
11
How to find fifth highest salary in a single query in SQL Server
Refer asked 11/12, 2008 at 6:6
7
Solved
I have a address in more than one column in a table.
SELECT FirstName, LastName, StreetAddress, City, Country, PostalCode
FROM Client
I am trying to concatenate address related columns into on...
Oliverolivera asked 8/3, 2011 at 16:37
6
Solved
I have a large table with say 10 columns. 4 of them remains null most of the times. I have a query that does null value takes any size or no size in bytes. I read few articles some of them are sayi...
Bloodless asked 16/9, 2010 at 22:1
4
Solved
Can someone explain me about SQL Server Reporting Service and using it in ASP.net?
Typically I design my reports by Crystal Report, assign the data source to crystal report an produce my report.
...
Homans asked 17/2, 2011 at 10:0
12
Solved
I've got data in SQL Server 2005 that contains HTML tags and I'd like to strip all that out, leaving just the text between the tags. Ideally also replacing things like &lt; with <, etc.
Is t...
Mallis asked 19/1, 2009 at 14:17
8
Solved
I have a table called Request and the data looks like:
Req_ID R1 R2 R3 R4 R5
R12673 2 5 3 7 10
R34721 3 5 2 1 8
R27835 1 3 8 5 6
Now I want to display the average of R1,R2,R3,R4 and R5
So I wr...
Scribner asked 9/9, 2011 at 21:39
5
Solved
I'm trying to create a basic database trigger that conditionally deletes rows from database1.table1 when a row from database2.table2 is deleted. I'm new to triggers and was hoping to learn the best...
Stopper asked 3/4, 2012 at 15:35
© 2022 - 2024 — McMap. All rights reserved.