|
You're stil making trouble for your self.
Anyway, use PATINDEX , to get the string between comma.
If your string 'a,b,c' then, the first PATINDEX will get 'a', the second will get 'b', and so on. Then you can update/copy the field using the value you got.
Here's the basic code:
declare @name varchar(15)
set @name='agf,b,c'
select substring(@name,1,patindex('%,%',@name)-1)
<italic>Work hard, Work effectively.
|
|
|
|
|
Thank you. it worked
phokojoe
|
|
|
|
|
I am trying to learn how to do a running total in Reporting Services. I have gone to the msdn website, but get bounced around from link to link. I just need a point in the right direction to learn how to do this please!
Scott Moore
|
|
|
|
|
I am trying to do a sql with wildcards in the "LIKE"
I tried _ and ? they wont work. * and % are working fine but i want some thing to match a single character. example
LIKE _ean
should return sean but it doesnt
any ideas????
Cheers
|
|
|
|
|
What do u mean by didn't work?
Can you post your code and the undesireable results ?
|
|
|
|
|
I am using the SQL Server Reporting service for creating the Reports but I am unable to create the Sub reports using the same. I've set the parameter property but the subreport is not visible in runtime. Can aybody have any idea how to create the Sub Reports.
Prashant Shinde
|
|
|
|
|
Hello friends!!
Please guide me where i will find best documents regarding craeting of "Stored_Procedure"
T.I.A
Shashank
|
|
|
|
|
|
Hi,
I'm new to programming (C#) and I can't find a sample of OleDb Transactions that can rollback BOTH ExecuteNonQuery() and myDataAdapter.Update all in one try/catch statement.
I found this link that shows the ExecuteNonQuery...
http://msdn2.microsoft.com/library/h8459s0c(en-us,vs.80).aspx
Is it possible to have both ExecuteNonQuery and DataAdapter.Update in the same rollback transaction?
thanks,
Ron
|
|
|
|
|
Hi all,
I'm currently trying to write a few lines into a csv file from a sql package. One thing I have to make sure is that the csv file doesn't end with a blank line. That is, I have to delete all new line and return feed from the end of the file. I've tried:
fileOut := utl_file.fopen('xxx', 'yyy', 'W', 32760);
utl_file.put_line(fileout, 'line 1' || Chr(13));
utl_file.put(fileout, 'line 2');
utl_file.fclose(fileOut);
But when I open the csv file created, there's always a blank line at the end of the file. It seems like a blank line is always being appended to the end of the file automatically on file close. Is this true? And are there any ways of avoiding this through sql?
Thanks
|
|
|
|
|
I created an address book with a login dialog box. It works fine. Now I would like to change the password and or user id. How can I do that?
bravo659
|
|
|
|
|
Magic.
For a better answer, you'll need to tell us how you created your login box in the first place. Given that you're in the SQL forum, I'm hoping you have a database with a table of usernames and passwords. If that is so, I'd have thought all you need to do is add to this table.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
you need to do is add edit to this table.
<italic>Work hard, Work effectively.
|
|
|
|
|
Depends on what you mean by edit. He needs to add a row if he wants to add a new user, assuming everything is set up decently.
However, if you regard adding a row as editing, and adding a column as adding, then you'd be right.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Now I would like to change the password and or user id. How can I do that?
By editing/ updating the record/row.
<italic>Work hard, Work effectively.
|
|
|
|
|
OK - you've got me. He needs to change a row, and I'm an idiot.
I missed the 'or'. One has to hope he doesn't intend on only having one user, but changing the details from time to time.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
I'm an idiot
Nah, you're just didn't read it carefully.
<italic>Work hard, Work effectively.
|
|
|
|
|
What i like to do since i already have the login box that i need to enter a user id and a password, I would need to change the password time to time.
How about adding more users with passwords?
I am fairly new to this sql server programming, but I am also using the MS Access to make it easier to understand what I am doing. Even though, all I have to do is change the Access to sql, and vice and versa. How can I do that?
bravo659
|
|
|
|
|
I reiterate - I need to know where your username and password are coming from, and how you use them, to answer more fully. However, if they are in a tabe of usernames and passwords, then you should be checking log in by looking for a username/password pair in the DB that's the same as what was entered. So you just need to edit a row to change the password, or add a row to add a user.
If the user is used for any authentication, etc, it should also have an ID, and any reference to the user done via ID. Then you can change the name, too.
If you have an Access DB and a SQL server one, and you don't use stored procedures, I'd imagine you could just connect to either from your code with no trouble.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What I am using is a userID and password in the Access DB tables.
What I would need to know is when I add a new child form, what would be the code to add and change a password.
In the first form for userid and password it has two textoxes, two buttons
for login and exit. Now, the child form would be with a three textbox, one for old password, change to new password, and authenticate new password.
If i want to change the username then I would create change username button which another form would appear to change the username. I really dont know how to code these changes. Could you help me in this instance.
bravo659
|
|
|
|
|
UPDATE tblLogin SET password = 'newpassword' where username = 'DessiBravo'
INSERT INTO tblLogin (username, password) VALUES ('christianGraus', 'hisPassword')
This is, of course, pseudo code in that I have no idea about your database schema.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I greatly appreciate for your assistance. I got the gist of it.
Another thing, how is C++. I am planning to go back to college to take up computer programming, and the school offers C++. I am currently using VB.Net. How is the comparison between the two.
|
|
|
|
|
VB.Net is a good language for knocking together basic applications without too much effort. C++ is harder to learn, because it's more powerful and more flexible. I'd recommend buying a book like 'Teach yourself C++ in 24 hours' in order to get a feel for it before signing on for a course. It's very different to VB.NET. However, whatever languages you learn, I think you're always better off for knowing at least 2 well, it makes you more of a programmer and less of a slave to one language.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi guys,
I want to replace two values in a column and I don't know how to do it with the replace function. I only know how to replace one.
select replace(col0, '100', 'add') as transaction_type
from sometable
Thanks in advance!
|
|
|
|
|
try nesting the replaces:
select replace(replace(col0, '100', 'add'), '200', 'del') as transaction_type
from sometable
|
|
|
|