|
use datename(dw,date) and use for loop to increment the day value
and count where dw=sunday
i hope this will be help full for you
|
|
|
|
|
hope this is what you are looking for
declare @mth varchar(4), @yr varchar(4), @dt datetime
set @mth = '4'
set @yr = '2007'
set @dt = convert(datetime, '01-' + @mth + '-' + @yr, 103)
-- to get first sunday of the month
select cast(case when ((7 - datepart(dw, @dt)) + 2) = 8 then 1 else ((7 - datepart(dw, @dt)) + 2) end as varchar(5)) + '-' + @mth + '-' + @yr
-- to get number of sundays
select case when (21 + (case when ((7 - datepart(dw, @dt)) + 2) = 8 then 1 else ((7 - datepart(dw, @dt)) + 2) end)) between 24 and 28 then 4 else 5 end
Regards
KP
|
|
|
|
|
hi kp,
thanq u very much,exactly iam searching for the same.
once again thanquuuuu.
|
|
|
|
|
Hi,
I have installed VS 2005 express for C#,C++ and SQL 2005 express. I am having problem to connect to SQL express database from C# and C+
From IDE, data connect -> Add Connection -> choose Data Source -> Microsoft SQL Database File -> Browse -> Select say model.mdf(or any .mdf in the Data directoy)
I always get :
Unable to open "c:\program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\model.mdf". Operatiing System error 32:"32The process cannot access the file beacuse it is being used by another process.)"
An attempt to attach an auto-named database for file "c:\program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\model.mdf" failed. A database with the same name exists,or specified file can not be opened, or is is located on UNC share.
I can access the same database from Microsoft SQL Server Management studio Express. I have also SQL 2000 installed inb the same machine but I don't think that matter - they have different directory,
Can anyone help?
Thanks
-- modified at 22:58 Wednesday 11th April, 2007
|
|
|
|
|
"file:///c:/program%20Files/Microsoft%20SQL%20Server/MSSQL.2/MSSQL/Data/model.mdf"
“Some have an idea that the reason we in this country discard things so readily is because we have so much. The facts are exactly opposite - the reason we have so much is simply because we discard things so readily. We replace the old in return for something that will serve us better.”--Alfred P. Sloan
|
|
|
|
|
i want to encrypt the password fied in my database.
i use MySQL Server
is there anyway to do it by the database or i should make it in my code?
|
|
|
|
|
It should be done in your code. Add some salt, encrypt it, then store the encrypted byte stream in the database. When you want to check a users password, add the same salt to the attempted password, encrypt it the same way, then retrieve the password from the database and compare the two byte streams.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
of course it should be done in the code...
for example md5() function in php...
and then it's easy to check passwords during authorization...
|
|
|
|
|
is there any equifilant function in C#
|
|
|
|
|
check this article:
http://www.codeproject.com/cs/database/md5sql2000.asp
may be it will help...
|
|
|
|
|
I am a fairly new to .net programming and I am wanting to pull similar data from an: access database, SQL database, and a mySql datbase - and combine the output to a repeater.
I can successfully connect to all databases and have a successful form for each one. But... the project would be so much better if I could just combine the data for output and not have the end user hopping around...
Does anyone have suggestions or pointers in the right direction for doing this?
|
|
|
|
|
cud u plez temme how can i connect sql wid c programing n which version of sql shud i use to access sql queres by turbo c compiler.
plz help me out.......
regardz
|
|
|
|
|
search for sqlclient from your turbo c documentation.
|
|
|
|
|
For this kind of problems I use 2 dimentional array or some class that's similar to the 2D array as far as functionality goes.
Then get the results from database 1 add it to the array, database 2 add it to the array ... database n add it to the array.
You probably need to search the rows in order to keep the rows straight.
|
|
|
|
|
hey guys can anybody tell me how to connect this file to database or server????
|
|
|
|
|
I have no idea what you mean by "connect *.dll file with the SQL database/server".
|
|
|
|
|
dhananjaysonar wrote: this file to database or server????
Which file?
“Some have an idea that the reason we in this country discard things so readily is because we have so much. The facts are exactly opposite - the reason we have so much is simply because we discard things so readily. We replace the old in return for something that will serve us better.”--Alfred P. Sloan
|
|
|
|
|
Jerry Hammond wrote: Which file?
I don't know if he meant .mdf file. I don't know why someone would want to connect a .dll to the database or server
|
|
|
|
|
plz...........
help me out .
how can i access sql queries by using c language..????
as i have to write a program in c only.
n how can i create header file to access sql queries in my program....????????
regardz
|
|
|
|
|
|
You have to use the C interface that's built into the database manager you are using. In other words, it depends on what DBM you are interfacing to: Oracle, SQL Server, DB2, etc. They should provide a "C language developers kit" or some such thing, that will have the appropriate headers in it. It's not generic, although the SQL standard (the X-Open version anyway) has a few things to say about interfacing with C (and other programming languages also).
|
|
|
|
|
H everyone,
I installed Sql Server 2005 and it installed good but when I want to use of it,it shows this message
"An error has occurred while establishing a connection to the server.When connecting to SQL Server 2005,this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.(provider:Names Pipes Provider,error:40 - Could not open a connection to SQL Server)"
I get this error when I am tring to :
1- I go to on the Visual studio Data Menu then select Add new Data source then select Database and click Next button then I click New Connection and select Microsoft SQL Server now it want Server name I enter server name and then I went to Select or enter database name but It didnt show any thing to then
I select Attach a databse file and enter a file(its extenstion mdf) and when I click ok I got above error
Is it possible I am getting this error because I enter wrong server name if yes how can I find correct name of server.
Thanks
|
|
|
|
|
Did you install SQL Server on your local machine or on a seperate machine?
|
|
|
|
|
I installed on my local machine.
|
|
|
|
|
Then you don't need to enter the server name, you can just enter '.' (a full stop), that corresponds to the local server.
Note: if you installed SQL Server 2005 Express, then you should use '.\SQLExpress' as the server name.
If this doesn't work, check if the SQL Server service is running.
Roel
|
|
|
|