0
votes
0answers
12 views
Sql Cursor…not adding data into the temporary created table
I have the below cursor. It generates the right set of statements but I am not able to insert the data into the temporary created table. The cursor is as below. Please have a look.
--use a cursor to ...
0
votes
0answers
27 views
SQL- Selecting Columns based on Date and Batch Number
I am using Chartrunner Lean to produce graphs based on Batch number and Run Date. In the data base there are multiple columns. There are two different sides of the plant which produce data and they ...
0
votes
1answer
17 views
Outer Join Or special Union
I have a special kind of Union to implement here, suppose R1 union R2, both table R can be split into 2 part, R.A part which is the content to be union and R.P part which is just a number.
So my ...
0
votes
1answer
48 views
too slow sql server select statement
I have sql server table Bookchapter with about ~ 140.000 rows, FullContent field is nvarchar (max) with long content inside.
SELECT COUNT(Id) AS Expr1
FROM dbo.BookChapter
WHERE ...
0
votes
3answers
21 views
Inner Join with an And Operator and Or Operator SQL
I am looking for a query which has two operator condition, let say, i have 3 columns in table a and table now, i want to see result as if (a.id=b.id or a.cid=b.cid) And (a.site=b.site)
Table a
...
2
votes
0answers
23 views
Need to get attribute name-value pairs for root element only, in T-SQL query
I've created a table-valued function which returns a list of attribute name-value pairs, when fed an XML fragment, based on Ben Davis's excellent response here. It works, but returns a list of all the ...
0
votes
2answers
25 views
SQL Timestamp Subtraction to get number of days
In the code below instead of active age I need to do a calculation with Open_time and the current time.
In other words i need to do if current time minus open_time is between 0 and 30, or 31 and 60, ...
0
votes
2answers
41 views
Connect To Proper Remote SQL server
On our development server we have three versions of SQL Server installed (SQLEXPRESS 08, SQL2008 R2, and SQL 2012).
In the services, I can see the following instances:
SQL Server (MSSQLSERVER)
SQL ...
0
votes
4answers
22 views
How to determine which columns are shared between two tables?
Very new to SQL Sever here... I understand the concept of joining tables, etc. but what is the easiest way to determine which columns are shared?
Say for instance we have Table 1 and Table 2, assume ...
0
votes
1answer
27 views
Difficult SELECT statement with only two columns
I have an SQL Server table structured as follows :
Table name : calendar.
Columns :
Calendar Date (smalldatetime)
Working Day (bit)
Calendar date has all dates, structured in the format ...
1
vote
1answer
20 views
Update a column in a database depending on the text in another column?
I have a column of type int and a column of type varchar(255).
Is it possible for me to loop through every row in my database and check for a certain string in the varchar(255) column, if that ...
0
votes
3answers
25 views
Sorting and ordering by two columns
I have a query which returns a result set like this:
Proj | release | releaseDt
1 | 2 | 1/2/2013
1 | 1 | 4/5/2012
2 | 1 | [null]
3 | 1 | ...
0
votes
2answers
34 views
Remove duplicates based on one column
I have to join multiple tables in a SQL Server database in order to use the fields in Report Builder. This SQL query is ran as a stored procedure. The problem is that it is returning multiple rows ...
0
votes
2answers
21 views
How can I pass a condition to a MIN statement in TSQL
I've got a table with the following columns
email, id, date
There's a unique key on email+id, so the table can contain multiples of an email address. id can be null.
I want to return results in ...
-3
votes
1answer
28 views
sql query to list a table content
I want to create a view for following table data using an SQL query.
empid Name Managerid
1 Vinoth Null
2 Raja 1
3 Ramu 6
4 Ramesh 6
5 ...