Author |
Topic |
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-04 : 21:47:30
|
Hi guys, how are you? I was wondering how I do to convert int to nvarchar and vice versa? Thank you very much. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-04 : 21:53:42
|
Thank you very much khtan. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-04 : 23:54:19
|
I am interested to know why you want to switch between these two MadhivananFailing to plan is Planning to fail |
|
|
Arijit
Starting Member
25 Posts |
Posted - 2007-07-05 : 00:08:27
|
In case of int -> nvarchar it is fine but when you try to convert the nvarchar -> int, on that time nvarchar should contain numeric values.Arijit |
|
|
facestheband
Starting Member
6 Posts |
Posted - 2007-07-05 : 00:24:01
|
You can also use the cast function i.e.cast(value as varchar) or cast(value as int) |
|
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-05 : 02:16:33
|
Well I'm doing forum right now and there is the threads that people can subscribe for them, as we've here in SQLTeam. The user who will create a new thread will be already subscribed for it. So in my database I rather create a field in the threads table to put the user's ids, separated by semi colons, from those who are subscribed. As the creator of this thread will be already subscribed so I had to convert the user_id from him to a string and put it on the subscriber’s field. That is for not just created a new table with just the subscribers. What do you think? Would be rather creating a new table or not?Thank you for the regard. |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-07-05 : 07:17:03
|
what happens with very popular threads...you end up with very large semi-colon seprated lists??what's wrong with having a child record...one per subscription?...far simpler...far more "db normal" as well. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-05 : 12:08:26
|
Thank you very much Andrew Murphy for you opinion and madhivana for the link, today yet I gonna read it and post here again. This peace of text I just cutted from the last thread I made here in SQL Team:Well I'm learning T-SQL everything all by my self, I'm struggling in web developer and I'm not working with team or anyone to have a point of reference, so if you saw my code you would be shocked, cuz it's a kind of nhacc... but the import think that they are working =D lol. so never mind.But I think is time for me to change. Thank you for your advices again. =D |
|
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-05 : 23:35:19
|
Yea I will create a new table with the subscribers for each thread. I knew that would be more easier do manage but I don't know why creating a new table had made me fell uncomfortable. Reading the article about data model that madhivanan pointed I came up with a problem. In this article mention about avoid duplicated data, but if creating duplicate data would help a lot when you make a query would you still not duplicate it? The case is when the user enter in the forum he would see the first user who created the thread and the last who posted there. I made a threads table that update a field, which correspond the last user who posted there. I know it's redundant because I could not have this field but would be more difficult to make the query, because would have to see all the posts made for each thread order by date, take last and the first one of each thread, and then give them back, beside of getting straight to the point. Well I had made my decision but it made me confused, I can handle the both but by your experience what seem to be the best?Thank you very much indeed. |
|
|
|