Click here to Skip to main content
15,075,394 members

Comments by damodara naidu betha (Top 114 by date)

damodara naidu betha 1-Jul-14 8:13am View
   
Didn't get your question. please clarify.
damodara naidu betha 1-Jul-14 7:32am View
   
Yes. You are right. 5+
damodara naidu betha 24-Jul-13 5:57am View
   
post your table structure and sample data. Please post what you did so far.
damodara naidu betha 23-Jul-13 9:06am View
   
Yes. You are right. No need to use joins here. You forgot to include columns DATE, BREAKS in GROUP BY clause.
damodara naidu betha 23-Jul-13 6:29am View
   
Welcome :)
damodara naidu betha 16-Jul-13 8:42am View
   
Out put format is not clear. Can you make it more clear? and please share data of both the tables.
damodara naidu betha 5-Jul-13 1:54am View
   
good 5+.. try solution2
damodara naidu betha 5-Jul-13 1:13am View
   
5+
damodara naidu betha 28-Jun-13 1:55am View
   
5+
damodara naidu betha 28-Jun-13 1:44am View
   
Really nice .. 5+
damodara naidu betha 28-Jun-13 1:31am View
   
5+
damodara naidu betha 27-Jun-13 6:25am View
   
You are right.. Raja Sekhar. By default Maxrecursion limit is 100. If we are not sure about the count, then we can set OPTION (Maxrecursion 0) to remove limit. Thank you very much for your voting.
damodara naidu betha 27-Jun-13 1:56am View
   
can you give the output format i.e how it should look like ?
damodara naidu betha 24-Jun-13 2:04am View
   
please change your question according to your requirement and also post what you have done so far to get the result.
damodara naidu betha 20-Jun-13 6:06am View
   
Month is declare as int in the table .. but data of month is in varchar
damodara naidu betha 19-Jun-13 2:39am View
   
5+
damodara naidu betha 19-Jun-13 2:25am View
   
Good one 5+
damodara naidu betha 19-Jun-13 1:30am View
   
Good one. 5+
damodara naidu betha 18-Jun-13 7:59am View
   
5+
damodara naidu betha 13-Jun-13 3:41am View
   
Deleted
I think you don't need to call database to count the number of sundays in current month. This can be possible through your front end coding. Lukeer provided good solution. I hope that will help you
damodara naidu betha 13-Jun-13 3:40am View
   
Good one Lukeer. 5+ .
damodara naidu betha 12-Jun-13 2:44am View
   
What if the previous row also contains null value in productid column?
damodara naidu betha 12-Jun-13 2:29am View
   
You can set identity on your column with seed "1". Please go through this link http://msdn.microsoft.com/en-us/library/aa933196(v=sql.80).aspx
damodara naidu betha 11-Jun-13 8:30am View
   
Excellent Mike. You removed complexity.
damodara naidu betha 11-Jun-13 8:27am View
   
Hi Mike. If it is temporary table then there is no question of deletion. Because OP is inserting
rows into the temporary table in a order (as he mentioned earlier )and generating result set by select query in a stored procedure. So Row_Number works fine here. So my solution can relay on the order of the rows in that temporary table.
damodara naidu betha 11-Jun-13 8:14am View
   
Actually you didn't provide your table structure. So I assumed that your table does't have any primary key column/ unique number column and wrote this query with Row_Number(Order By(Select 1)).If you have column in you table which maintains unique number for the rows, you can put that in Row_Number() OVER (Order By your column name). Try it and let me know the status.
damodara naidu betha 11-Jun-13 8:04am View
   
Sorry. I didn't get your question. Can you explain it?
damodara naidu betha 11-Jun-13 8:02am View
   
Thanks.
damodara naidu betha 11-Jun-13 7:47am View
   
I have changed query according to your "Qty" columns's data type. Now it is running fine in my machine. Please let me know the status. If it is running fine then remove your first comment, please.
damodara naidu betha 11-Jun-13 7:43am View
   
Deleted
Do you want me to update my solution according to your "QTY" column's datatype ?
damodara naidu betha 11-Jun-13 7:37am View
   
what is the data type of the "Qty" column in your table ? I have used "int" for this column in my table
damodara naidu betha 25-Feb-13 2:22am View
   
So what should be displayed in out time column in this case?
damodara naidu betha 23-Jan-13 1:23am View
   
Nice..
damodara naidu betha 23-Jan-13 1:12am View
   
5+
damodara naidu betha 16-Nov-12 8:08am View
   
5+
damodara naidu betha 16-Nov-12 7:52am View
   
Yes we can help you on this. But I have a doubt that what if a device is stated and stopped twice in a particular day? I mean two records in your table for a particular day.
damodara naidu betha 14-Nov-12 0:19am View
   
how to show the output? and please provide the sample data and table structure...
damodara naidu betha 8-Nov-12 5:25am View
   
which commets? Cell comments or work sheet comments?
damodara naidu betha 7-Nov-12 23:58pm View
   
5+
damodara naidu betha 7-Nov-12 7:16am View
   
5+
damodara naidu betha 7-Nov-12 6:56am View
   
5+
damodara naidu betha 7-Nov-12 6:56am View
   
5+
damodara naidu betha 7-Nov-12 6:55am View
   
post your table data ...
damodara naidu betha 7-Nov-12 0:28am View
   
Please post your table's script.
damodara naidu betha 7-Nov-12 0:25am View
   
this works only in SQL server. But the answer is correct. My 5+
damodara naidu betha 7-Nov-12 0:25am View
   
Please provide tables structure along with sample data.
damodara naidu betha 7-Nov-12 0:22am View
   
you need to get execution time also?
damodara naidu betha 7-Nov-12 0:21am View
   
5+
damodara naidu betha 5-Nov-12 5:49am View
   
5+
damodara naidu betha 2-Nov-12 2:39am View
   
If you have Attributeorder as an identity column in your table, then why are you trying to insert a value into that? Engine takes care of it automatically.
damodara naidu betha 2-Nov-12 2:38am View
   
Deleted
If you have Attributeorder as an identity column in your table, then why are you trying to insert a value into that? Engine takes care of it automatically.
damodara naidu betha 1-Nov-12 10:12am View
   
5+
damodara naidu betha 1-Nov-12 10:05am View
   
not possible in Sql server
damodara naidu betha 1-Nov-12 10:05am View
   
This is not possible in Sql server
damodara naidu betha 1-Nov-12 3:10am View
   
Please explain it clearly..
damodara naidu betha 1-Nov-12 3:08am View
   
please post your tables design along with sample data.
damodara naidu betha 1-Nov-12 2:17am View
   
simple and useful..
damodara naidu betha 31-Oct-12 9:24am View
   
I have posted an answer for the same question .. check it :)
damodara naidu betha 31-Oct-12 9:12am View
   
5+
damodara naidu betha 31-Oct-12 7:36am View
   
5+
damodara naidu betha 31-Oct-12 7:33am View
   
please post table structure, sample data and explain what you exactly needed.
damodara naidu betha 30-Oct-12 9:09am View
   
My 5+
damodara naidu betha 30-Oct-12 9:08am View
   
My 5+ :)
damodara naidu betha 30-Oct-12 6:08am View
   
Thank you Aarti
damodara naidu betha 30-Oct-12 3:30am View
   
hi.. what is the table structure? and explain EL,CL,ML.
damodara naidu betha 29-Oct-12 6:17am View
   
5+
damodara naidu betha 29-Oct-12 3:34am View
   
hi. Is Values Columns count fixed?
damodara naidu betha 26-Oct-12 7:04am View
   
5+
damodara naidu betha 26-Oct-12 6:45am View
   
any vote?.. ;)
damodara naidu betha 26-Oct-12 4:03am View
   
I am confused. Please explain it clearly
damodara naidu betha 26-Oct-12 3:58am View
   
which one? Can you send me the link please?
damodara naidu betha 25-Oct-12 5:54am View
   
Please post them in this site.
damodara naidu betha 25-Oct-12 2:38am View
   
which database and version you are using ?
damodara naidu betha 25-Oct-12 1:55am View
   
5+
damodara naidu betha 25-Oct-12 1:44am View
   
you are right Marcus..
damodara naidu betha 25-Oct-12 1:23am View
   
5+
damodara naidu betha 24-Oct-12 3:18am View
   
5+
damodara naidu betha 24-Oct-12 2:12am View
   
welcome
damodara naidu betha 17-Oct-12 3:08am View
   
Please provide tables schema and sample data, because we can't log in into your db :)
damodara naidu betha 16-Oct-12 9:45am View
   
Thank you Arti... :)
damodara naidu betha 16-Oct-12 9:40am View
   
Any rating... ? :)
damodara naidu betha 16-Oct-12 8:53am View
   
you created a table valued function to get rows like

values
------
1
2
3
1
2
But I didn't use any function in my query. It is a direct method. Is there any flaw in my method? please let me know :)
damodara naidu betha 16-Oct-12 8:42am View
   
Hi Arti. Can you explain how this following query returns the required result
select name,b.id as ids
from mytbl
cross apply (a.ids) as b
damodara naidu betha 16-Oct-12 7:25am View
   
oops.. Ajax call didn't work :). Now it is rated.
damodara naidu betha 16-Oct-12 7:16am View
   
My 5+
damodara naidu betha 16-Oct-12 1:40am View
   
Is there any relation ship between the two tables?
damodara naidu betha 15-Oct-12 2:35am View
   
My 5
damodara naidu betha 15-Oct-12 1:57am View
   
There is no relation ship between first two tables. Please provide the correct info.
damodara naidu betha 15-Oct-12 1:51am View
   
My 5..
damodara naidu betha 12-Oct-12 9:40am View
   
do u need COUNT(licensecount) or SUM(licensecount)?
damodara naidu betha 12-Oct-12 3:35am View
   
values in Total column are incorrect.. they should be 12700,15500
damodara naidu betha 12-Oct-12 2:18am View
   
5+
damodara naidu betha 12-Oct-12 2:14am View
   
Good one Marcus.. 5+
damodara naidu betha 11-Oct-12 9:20am View
   
Deleted
I think he wants to get the same result using Common Table Expression and both statements
SELECT @RecordCount = COUNT(*) FROM #Results ( will not give any error) and
SELECT @RecordCount = (SELECT COUNT(*) FROM #Results) work fine.
damodara naidu betha 11-Oct-12 8:08am View
   
Is EmployeeNo an identity column?
damodara naidu betha 11-Oct-12 7:06am View
   
5+
damodara naidu betha 11-Oct-12 5:56am View
   
welcome :)
damodara naidu betha 11-Oct-12 5:54am View
   
Correction..

while(dr.Read())
{
TextBox1.Text +=dr[0].ToString()+" ";
TextBox2.Text +=dr[1].ToString()+" ";
}
con.close()
damodara naidu betha 11-Oct-12 5:16am View
   
Good :)
damodara naidu betha 11-Oct-12 2:53am View
   
what is the extension of the script file? If it is .sql, then it can be opened if you rt click on it and select open with Notepad. If you double click on it it will launch SSMS there you can edit the .sql file.
damodara naidu betha 11-Oct-12 2:07am View
   
Good one. My 5+
damodara naidu betha 11-Oct-12 2:05am View
   
Nice.5+
damodara naidu betha 11-Oct-12 2:03am View
   
Can you post what is the result coming and what should be the desired out put along with input data?
damodara naidu betha 11-Oct-12 1:05am View
   
Hi,
I have a doubt. Why we need to check twice in same product table?. We can do the same like select * from product where pid=@pid.. instead of using the sub query.Both select * from product where subcate_id in (SELECT subcate_id FROM product where pid=@pid) and select * from product where pid=@pid give same result and select * from product where pid=@pid is more efficient than your query because it is avoiding 'in' and sub query.
damodara naidu betha 10-Oct-12 8:13am View
   
I have modified the answer, and here is your query....
DECLARE @param VARCHAR(MAX) = '3,24,2,45';
DECLARE @Xparam XML;

SELECT @Xparam = CAST('<i>' + REPLACE(@param,',','</i><i>') + '</i>' AS XML)
SELECT x.i.value('.','INT') FROM @Xparam.nodes('//i') x(i)
damodara naidu betha 10-Oct-12 6:22am View
   
I had problem with the editor. I have modified it, now you can test the query. Here I am explaining the sub query. First I am replacing the ',' in the @param value with . So the entire varchar becomes <i>3</i><i>24</i><i>2</i><i>45</i>. After that I am casting it into XML type and storing in @Xparam of type XML. If I run the
SELECT x.i.value('.','INT') FROM @Xparam.nodes('//i') x(i) .. it returns a result set like ..
3
24
2
45
This is called XQuery( querying XML types).
damodara naidu betha 9-Oct-12 7:21am View
   
damodaranaidu.betha@gmail.com , please explain your question clearly..
damodara naidu betha 9-Oct-12 7:21am View
   
Deleted
damodaranaidu.betha@gmail.com
damodara naidu betha 9-Oct-12 6:24am View
   
Hi Chinnu.. pls provide the structure and sample data of the Price table.
damodara naidu betha 8-Oct-12 9:09am View
   
welcome
damodara naidu betha 8-Oct-12 2:33am View
   
Good one.But this needs be corrected. To get difference, replace ISNULL(Y.ColA,0)-X.ColA With ISNULL(X.ColA,0)-Y.ColA, and you are taking row number order by ColA. This sorts the column values in ascending order. So the query doesn't produce desired result.
damodara naidu betha 4-Oct-12 6:25am View
   
This query works if the column values contains the word starts with ',' and ends with ','. For example assume that the column contains '200,300,400'. It doesn't return row if we replace the "word" with "200". It returns row if we place with 300 instead of 200.
damodara naidu betha 3-Oct-12 7:12am View
   
Hi .. we have converted the columns values into XML Elements in the CTE. So each column value becomes an element value in the XML. To access this value we use x.i.value ( In Xquery)
damodara naidu betha 28-Aug-12 6:42am View
   
Hi Madhu .. provide some test data please so I can work on it.