|
yeah, i wrote a function which it was splitting the string based on comma, and then inserting those into the temp table. the temp table had my code in records, but still the procedure didnt worked that way too.
i think there is something tricky in such cases, i am searching to find that case. i need your help too.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Well, its a fairly simple join.
declare @Split TABLE (.....)
insert into @Split
select .. from your_split_function
select * from table t1
join @split s on s.code = t1.code
if it still fails to return records make sure you are trimming spaces from the values in your split function
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
thank dude, this method is very cool, trimming mostly solved my issue
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Please to have helped
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
I want to protect my database with ID & Password.
How it will be done.
|
|
|
|
|
Sometimes its difficult to answer questions like this in the Forums , because people don't give us enough information. We have to help them and think what they are trying to achieve. let me tell you what came into my mind when i saw your question.
Because if you are having an SQL Database is Hosted into the SQl Server and that Server is Protected by a sa password or you can add more users or restrict other users from accessing your database from the permission of your Database. So you see , you did not give us enough information.
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/
|
|
|
|
|
i dont want my client will access my database in server.
now tel me is there any way to avoid this?
|
|
|
|
|
Its Simple, Dont give the Password to the Server, if they know it change it
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/
|
|
|
|
|
You're not the dbowner?
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
Hi,
Sir, I m using SQL SERVER 2005 in Windows authentication mode. Anybody on my PC can access the server by using same authentication. That means they can access their own database but they also can access my own too & I don't want to have access to them.
I want to secure my particular on ly.
I think it is more clesr now.
Please help.
|
|
|
|
|
Now in that case , Change the Authentication and use SQL Authentication. This means you have to give up Windows Authentication and have a spacial credentials for your Database Remove your Windows username from the Permissions of the Database and Add a new username that can only be used by you, then in that case you and only you can access the DB. remember the Windows Authentication does not even ask you for a password as long as you have the correct username the user can enter and that is not advisable in a secure environment.
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/
|
|
|
|
|
Many Time I am Also Suffer From this Problem but at a long time i find a solution
about this problem's.
First you Have To Change Window Authentication mode to mix mode authentication.
use Done this by Done From Inside SQL Server Object Explore\Properties\Security\Server Authentication Change to mix mode Authentication
or
by using Query run in Window Authentication mode
1)EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
2)Alter login sa enable
3)Alter login sa with password ='[abc]' --any Password
4)EXEC sp_revokelogin 'BUILTIN\Administrators'
5)Restart you'r SQL Server Service
and Batch File in C#.NEt is
int iChar = 34;
char aChar = (char)iChar;
StreamWriter sStr = new StreamWriter(GetWorkingDir + "//SQLSEREVR.Bat");
sStr.WriteLine("@echo off ");
sStr.WriteLine(@"CD\");
sStr.WriteLine(@"osql -E -S .\sqlexpress -Q "+aChar.ToString()+"Alter login sa enable"+aChar.ToString()+"");
sStr.WriteLine(@"osql -E -S .\sqlexpress -Q " + aChar.ToString() + "Alter login sa with password ='[abc]'" + aChar.ToString() + "");
sStr.WriteLine("Net stop " + aChar.ToString() + "SQL Server (SQLEXPRESS)" + aChar.ToString() + "");
sStr.WriteLine("Net start " + aChar.ToString() + "SQL Server (SQLEXPRESS)" + aChar.ToString() + "");
sStr.WriteLine(@"osql -E -S .\sqlexpress -Q " + aChar.ToString() + @"EXEC sp_revokelogin 'BUILTIN\Administrators'" + aChar.ToString() + "");
sStr.WriteLine("Net stop " + aChar.ToString() + "SQL Server (SQLEXPRESS)" + aChar.ToString() + "");
sStr.WriteLine("Net start " + aChar.ToString() + "SQL Server (SQLEXPRESS)" + aChar.ToString() + "");
string sBatchFileName = GetWorkingDir + "//SQLSEREVR.Bat";
|
|
|
|
|
Your DB? Is this DB on a server you do not own/admin? Have you asked the srvadmin?
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
Hi Experts
I Have A SQL Server 2005 Database i want that no body or person can copy my
.mdf file. i mean to say that no body can copy my .mdf file at attach at different
location for security issue. is their any way to protect to copy
or restrict the attachment of database at different location
Thank u
Dinesh Sharma
|
|
|
|
|
Yes. Upgrade to SQL 2008.
I kid you not.
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
I am using sql server 2005. I have a table like this
COL1 COL2
A 1
A 1
B 2
C 1
C 2
and i need output like this
COL1 COL2 No:
A 1 2
B 2 1
C 1 1
C 2 1
How many times the same COL1 and COL2 coming, that should be the column NO: in the output.. Please not that here i dont have any inputs like A,1 etc.... This is just the pattern, so i need a general quesry.
My small attempt...
|
|
|
|
|
What you need is a very simple select statement using grouping.
select Col1, Col2, count(col1) as No
from tablename
group by Col1, Col2
order by Col1, Col2
|
|
|
|
|
you are great
My small attempt...
|
|
|
|
|
hi all......
i got the solution... i think we can use the same technique which use for duplicate checking
SELECT COL1, COL2, count(*)
FROM table
GROUP BY COL1, COL2
i think this is fine
My small attempt...
|
|
|
|
|
Wow, looks remarkably like the answer I gave you 6 mins ago...
|
|
|
|
|
i seen your comment after i post my... anyway thanks...
My small attempt...
|
|
|
|
|
Hi
is it possible with cross query to do this ? (in Access 2007)
I have this table:
50 | A1
60 | A1
70 | B1
80 | B1
90 | C1
I need to get this result:
A1 B1 C1
sum | avg sum | avg sum | avg
110 | 55 130 | 75 90 | 90
|
|
|
|
|
50 | A1
60 | A1
70 | B1
80 | B1
90 | C1
I need to get this result:
A1 ------------------ B1 --------------- C1
sum | avg ----- sum | avg ----- sum | avg
55 | 110 --------- 75 | 130 ------ 90 | 90
|
|
|
|
|
No, it's not. What are you actually trying to achieve?
|
|
|
|
|
I try this:
TRANSFORM Sum(Worki.Value) AS XXsum
SELECT Worki.Name AS Name, Worki.Tdate AS Tdate, Worki.ID AS ID
FROM Worki
GROUP BY Worki.Name, Worki.Tdate, Worki.ID
PIVOT Worki.Trit;
but I how can I get the average ?
|
|
|
|