Wednesday, March 28, 2012
How do I access a mdf-file directly?
I want to access a sql server file without having sql server installed on my laptop. How can I do this? Can you give me an example please because I'm new with it.
Thx a lot!
TomI don't think this can be done. The closes you can get is to do a minimial installation, use the Personal Desktop edition. I don't think there is any tool our COM object that will allow one to open the file and read throuigh it.
If you need to analyse some data or tables you could export the data to MS Access, Excel or flat files.|||You will need to install either msde (I think) or sql server then you can do a sp_attach_single_file_db to access the database.|||I dont think that you would be able to do it.
But as suggested previously, you can try minimal installation and then get the data out in the format that you want.
Thanks|||hii
i think there is a microsoft desktop engine which minimally installs the components required by SQL. Try that that. i dont have info on that at the moment . will try to get u|||hii
Install MSDE which comes in the office 2000 Cd and Use SQL DMO object and attach it to the instance of MSDE. Try , it should work
:confused:
Friday, February 24, 2012
How can I use regular expressions in WHERE clause directly?
How can I use regular expressions in WHERE clause directly?
select * from mytbl where myfld like '[0-9]*key'
Sorry - AFAIK SQL does not allow regular expressions in the WHERE claus.
You have to search for the closest match to your regex which you can express with the LIKE patterns and do the rest of the filtering on the client side.
--
SvenC
this is not allowed..there is a turnaround though..
u can prepare the query and assign it to a variable and then use the 'execute' command to run it, takin ur example..
declare @.sql varchar(100)
set @.sql = 'select * from mytbl where myfld like '[0-9]*key''
execute(@.sql)
in addition u can also use variables while to prepare a query..eg u can take the column to compare in a variable to make it more dynamic
declare @.column varchar(10)
set @.column = myfld
set @.sql = 'select * from mytbl where' + @.column+ ' like '[0-9]*key''
|||SQL Server doesn't directly support regular expressions. But it's easy to add them: just create a User Defined Function (UDF) which maps onto a .Net method. And >net does support regular expressions out of the box. To get an idea of how to do this, check this article:
http://www.u2u.be/Article.aspx?ART=RegExp