Hi all,
How to generate sql script file from C# codebehind? The script file will contain create and drop statement of a storedproc in the db.
How to generate the script from db in C# and write to an .sql file?
Is it possible to generate script of create and drop statement of table or storedproc from db in C#
Please help.
...
My current project is a WPF application with an SQL Server back end.
In WPF, the UI can only be modified by the UI thread. If a UI modification needs to be done on another thread, then the dispatcher object can be called and given an action. Effectively, this is mapping my Delegate to a WM_ message.
Since the linq datacontexts to SQL S...
I've just been reading 'Give us Real Domains!' on SQL Server MVP Erland Sommarskog's SQL Server Wishlist.
I was thinking of trying out CREATE TYPE with bound rules but was alarmed to learn that this is a deprecated feature.
Does SQL Server have anything resembling support for domains that is worth using? Are bound rules are worth usin...
Dear All,
I am developing a application that of several modules, Each of module developing seprately.I have to develop a integration module the call the forms of different modules.so i have to decided that to develop dynamic menu from database where module and form name is stroed.How to acchieve this.plz help
...
Hi all,
How to retrieve create statement for table from db in C#?
I need to create a script file containing create statement
for an existing table in db using C#.
I can generate create statement of storedproc using sp_helptext but can't generate it for table.
Please help.
...
Hello everybody,
can someone please explain the difference between these 2 pieces of code:
var temp = (from c in Context.SomeTable
select new SomeObject { name=c.Name, created = c.Created}).ToList();
and this :
var temp = (from c in Context.SomeTable select c);
foreach(SomeTable t in temp)
{
SomeObject so = new SomeObjec...
I am using help of SqlServer.Management.Smo to rename an attached MS-SQL database.
Dim db As New Database = ActiveSQLServer.Databases(OLD_NAME)
db.ExecuteNonQuery("ALTER DATABASE " & OLD_NAME & " SET SINGLE_USER WITH ROLLBACK IMMEDIATE")
db.ExecuteNonQuery("ALTER DATABASE " & OLD_NAME & " MODIFY NAME = " & NEW_NAME)
The problem is tha...
I guess the default path for the SQL Server files is located at:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
Is there any way of reading the default directory with the .NET Framework?
...
By "variable format" I mean that each row in the text file begins with a single character code denoting the record type, and each record type has a different format. I believe this is some sort of fairly common mainframe data export method. What makes matters worse is the fact that the record types are actually hierarchies. The codes in ...
Is there anyway to loop through a table variable in T-SQL?
DECLARE @table1 TABLE ( col1 int )
INSERT into @table1 SELECT col1 FROM table2
I use cursors as well, but cursors seem less flexible than table variables.
DECLARE cursor1 CURSOR
FOR SELECT col1 FROM table2
OPEN cursor1
FETCH NEXT FROM cursor1
I would like to be ...
how can i decide this problem?
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[GetDataById] ()
RETURNS INT
AS
BEGIN
DECLARE @query NVARCHAR(500)
DECLARE @j INT
SET @query=N'select * from catalog'
EXEC sp_executesql @query
RETURN @j
END
When I try to exec this one: select dbo.GetDataById()
I get an ...
So, I've been searching around and I've found things similar to my problem, but I need more help to get a real solution.
I'm trying to construct a query that will return 2 columns of data, the first column should be a list of the column names themselves and the second should be the value of that column.
Visually it would look like this...
I've got a problem I was wondering if there's an elegant solution to. It is a real business problem and not a class assignment!
I have a table with thousands of records, some of which are groups related to each other.
The database is SQL 2005.
ID is the primary key. If the record replaced an earlier record, the ID of that record is i...
Hello All
I have a huge problem with the REPLACE SQL function in Microsoft SQL Server Management Studio Express.
When I do following query
SELECT REPLACE('ArticleNumber', 'S401', 'I0010')
SELECT REPLACE('ArticleNumber', 'S302', 'I0020')
SELECT REPLACE('ArticleNumber', 'S303', 'I0030')
SELECT REPLACE('ArticleNumber'...
I would like to publish some data of a sql server 2k to msaccess databases.
I'd like to do that given a table supplying datatransformation info, for example :
tablenameOnServer | pathToPub
------------------------------------------------------
Clients | D:\Data\Pub1\ClientData1.mdb
Orders | D:\OtherData\Pub...
I have an issue where I'm creating a greenfield web application using ASP.NET MVC to replace a lengthy paper form that manually gets (mostly) entered into an existing SQL Server 2005 database. So the front end is the new part, but I'm working against an existing moderately normalized schema. I can easily add new tables, views, etc. to ...
I currently use SQL Server to store products in a large catalog web site. I'd like to rebuild the simple categorization we have to something with tags & facets so that users can filter down to relevant subsets as quickly as possible. I should NOT do this myself. Without going too far afield (VM to host level 3 aeai) does anyone know of a...
Visual studio 2005 is still asking me for a create or alter after writing create procedure. What could be wrong?
USE metroengineeringdatabase
GO
CREATE PROCEDURE dbo.InsertRecords (
@assetcodeId nvarchar(20),
@name_of_asset nvarchar(20),
@unit_no nvarchar(20),
@manufacturer nvarchar(20),
@make nvarchar(20),
@model nvarchar(20),
@capaci...
Using a TSQL update command against a SQLServer database, how can I update a column of type FLOAT with the smallest possible double value?
The smallest possible double value in hex notation being 3ff0 0000 0000 0001
(http://en.wikipedia.org/wiki/Double%5Fprecision)
...
Consider this T-SQL:
CREATE USER my_test_user WITHOUT LOGIN;
SELECT USER_NAME(), USER, SUSER_SNAME(),SYSTEM_USER, suser_name();
EXECUTE AS USER = 'my_test_user' WITH NO REVERT;
SELECT USER_NAME(), USER, SUSER_SNAME(),SYSTEM_USER, suser_name();
I'm looking at using these accounts WITHOUT LOGIN for auditing purposes. Basically, my "get...