|
WITH ABC
AS
(SELECT NAME,FLAG,QUEUE,ROW_NUMBER() OVER(ORDER BY NAME) AS [RN] FROM T1)
SELECT * FROM ABC WHERE RN % 2<>0
|
|
|
|
|
Hi man,
I hope that by mistake you replied to me instead of replying to the original poster.
Second, the user expects the answer not to be in stored proc.
But your solution is nice
Niladri Biswas
|
|
|
|
|
I have a project (web application) where i have to show hierarchical data in form of a tree.For example A has two children B(left) and C(right). B has two children D(left) and E(right). C has two children F(left) and G(right) and so on... My problem is I dont know the exact SQl query to count the number of all the subsequent children for a particular member. Like "how many children A has to his left or right (depthwise)" also i need to show the initial 15 members in form of a tree. If I do recursing for every node using C# code(which I am using) and then filling the form and going on it is going to take forever. So if someone knows the proper SQL query please help me. Or if anyone has any idea?Please tell me.Thanks
|
|
|
|
|
I assume that you have searched for this, but on the off-chance that you've missed it, here[^] is a link to a relevant article. It also has some interesting links in it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have a datagridview that takes data from a dataset from a table with an ID that is an identity specification number that is supposed to automatically give the next number. When I open a new line it should give me the next number but it doesn't. What am I missing?
|
|
|
|
|
I'm guessing that you won't get a number until the record is saved.
I are troll
|
|
|
|
|
Datagridview is not an SQL table. Until the Record is Saved and the Grid is Refreshed you will not get an Identity number. If you made a gridview to generate the number , it does not mean the Database will do the same thing. If your Application is a multi-user application you will have problems e.g lets say a user assumes that the ID is the 10 and the user user does an insert somewhere and faster that the user that assumed it was 10 and the other user will get the identity of 10 and the assumer will get 11.
Hope it helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I do agree.. you can add an external col into your grid.
Md. Marufuzzaman
|
|
|
|
|
In some grids I get the right number, in one grid I get a minus number which saves ok afterwards but in the grid I'm working on now I don't get any number at all
|
|
|
|
|
Hi,
I am developing an application in which i use to select data from one grid remove that & display it to the second grid.
I store those data in a local mdb file . when i am selecting rows in bulk(around 50-70 at a time)and then wanted to cut and display in the second grid i am getting this error .
Please help.
|
|
|
|
|
Are you forgetting to close your connections, between operations? Or forgetting to close something that you have opened. A DataReader, or something like that.
Without seeing the code you are using, it is difficult for me to offer more than that. Others might be more helpful.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
I am a newbie in programming and all the IT stuff,currently I am developing a webapplication to enhance my knowledge . I am using visual studio 2008,Sql server management studio 2005;in my application I am simply adding names and passwords in a table in Sql.
1)The application works fine when both Sql and published webappliaction on IIS are on same machine!
2)now I want the Sql database to be on other machine, and my published application on other system so that there are two different servers in LAN one the application server and other the database.
please help!
Thanks
shankbond
|
|
|
|
|
shankbond wrote: he application works fine
So you have a working connection string already in your app, it will probably have "localhost" in the string. Change "localhost" to the remote server name.
You will probably need to change from integrated security (using your windows logon) to a SQL userid and password for the app to connect ans include them in the connection string.
A good research site is connectionstrings.com/[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Mycroft Holmes wrote: You will probably need to change from integrated security (using your windows logon) to a SQL userid and password for the app to connect ans include them in the connection string.
the above solution will help my application to use a sql id and sql passsword fine
but what other changes(or configure) will I have to do in sql server itself?
Thanks
shank
|
|
|
|
|
"Allow SQL Server to accept remote connections"
Quoted, since it is a common search-phrase on Google
I are troll
|
|
|
|
|
You will need to set up the SQL user with adequate permissions on your database. That's it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: You will need to set up the SQL user with adequate permissions on your database. That's it.
ok I m trying; any good resources you know except msdn?
shankbond
|
|
|
|
|
Hi,
Actually when you remotely perform any SQL request (using OPENROWSET , BLOB type data) SQL server
need the AuC first. That you have the permission to perform this operation.
Md. Marufuzzaman
|
|
|
|
|
Hey,
I have this table:
JAN FEB MAR APR
--- --- --- ---
10 10 10 10
Suppose I'm in March now, how would I total the values of the two previous months (ie. JAN and FEB) to have 20
Please help.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Well, if that was what I wanted to do, I wouldn't start from there.
Has this design been forced on you, or are you free to choose your own?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
It is forced on me, here's the big picture:
Jan Feb Mar Apr
--- --- --- ---
Budget 10 10 10 10
Actual 10 5 10 0
... 0 0 0 0
... 0 0 0 0
... 0 0 0 0
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Sorry to be so long in replying.
I'm with Luc here, unless somebody else comes up with a viable solution I'd be investigating PIVOT. I have never used it, so I can't be of much help.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry, Yes, it can be solved using pivot tables or the decode function but my problem is far more complicated to be solved by either of them alone!
Thanks for your time mate!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Is that a SQL table or a flatfile table such as Excel?
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
Hey Jerry,
It's a SQL Table, but dont worry, I've already found another way round, although it's not professional but it solves my problem. It was for a crystal report file and I figured out I can simply create a typed dataset with the exact names and data types of those of the generated query, generate the datatable fields from the invoking form using ado and set the datasource of the report to the dataset I just created.
Thank you for your time Jerry!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|