sql-server

Formatting Database Schema From SQL Server

Ok I ve been asked to generate a schema for a database that contains 20+ tables I ve used SQLServer Management studio to extract out the database schema but cannot export it into word If I copy it as a diagram the tables are too small Does anyone know how to extract the schema from a sql server database so that it is presentable to a ...

Database Schema Diagram From SQL Server

Is Visio the only way here?? I saw another stackoverflow question about this http://stackoverflow.com/questions/30474/database-schema-diagram-design-tool And whilst Sql Designer is nice I dont want to draw all the tables by hand - Is there any way to short circut this and upload SQL DDL and it generates the tables in a diagram?? ...

SQL date,period comparison

Hi I'm having some problem with logic of the comparison of some periods. I have a table in my database that looks like this: Id|startDate |amount of weeks| -------------------------------- A1|2010-01-04 | 3 B3|2010-01-11 | 2 all the startDates start on the same day of the week (Monday) now I need to write an sql where I have 2 para...

How to perform INSERT/UPDATE to Linking (Join) table which has FKs to IDENTITY PKs

I am new to designing my own database. My project is orders/products/inventory type data, using SQL Server 2005. During my reading I came across several customer/order type of examples, and I decided to use linking-table (sometimes here called junction, or join table) for my Order_Details since I had many-to-many relationships between OR...

Update SQL Server

pretty simple query for u guys, im just new to this. here's the scenario - one table with 10 fields. On first aspx page, i do insert first 5 fields (programid is one of them). On the second aspx page, i update the same record entered in previous screen (same programid) for the next 5 fields. but the programid is not unique. one programid...

Subsonic on a Console application

Can I use the Subsonic on a console application? If so where should I have all the Web.config details like ConfigSections entry, Subsonicservice etc? Any help is highly appricated ...

sql server (updating)

if i update one record in table ...after updating how can i ensure that the table has only one affected record. Im using sql server 2005 ...

To get date from datetime in sql

I have datecreated field in a table. It contains value as "2009-12-30 11:47:20:297" I have a query like this: select * from table where DateCreated = getdate() Although one row exists with today's date, I am not getting that row while executing above query. Can anybody help? ...

Sql server 2005 acting case sensitive inspite of case insensitive collation

I am having following issue.Even after case insensitive collation. SQL server is treating @Result and @result differently. Am i missing something.Please help. SELECT DATABASEPROPERTYEX('OA_OPTGB_0423', 'Collation') SQLCollation; SQL_Latin1_General_CP1_CI_AS DECLARE @Result varchar(2000) SELECT TOP 1 @result = addr.address_id ...

SQL query minimum maximum

I need to get maximum and minimum values but also I need to get row id of these maximum or minimum on the same row. SELECT MIN([Value]), MAX([Value]), id FROM [AnalystEstimates].[dbo].[AnalystEstimateValues] GROUP BY indicatorid ...

SMO System.Security.SecurityException

Hello everybody I wrote a backup procedure using smo. this procedure works great on my dev box, but once deployed to the hosting company's web server it throws above exception ("System.Security.SecurityException: That assembly does not allow partially trusted callers.") I did some research on the subject and it seems that hosting compa...

are stored procedures faster than functions or not

I am using stored procedures at the moment but I have a lot of stuff like this: if ... begin select 'success' return end if ... begin select 'notgood' return end if ... begin select 'someelse' return end so I'm thinking that it would be a better idea to use functions instead, but is there any performance difference between functions a...

Ajax ReordeList and asp:FileUpload Problem

Hi there, I have a ReorderList which is working fine, inside the InsertItemTemplate, I've added a asp:Fileupload to add images to the list and database. All of these controls are inside a DIV. How could I reach to this (asp:FileUpload) in C# to check whether it has a file or not, this is the C# part of the code: ////////////////////...

Varchar with trailing spaces as a Primary Key in SQL Server 2008

Is it possible to have a varchar column as a primary key with values like 'a ' and 'a', is gives always this error "Violation of PRIMARY KEY constraint" in MS SQL Server 2008. In Oracle dons't give any error. BTW I'm not implementing this way I'm only trying to migrate the data from oracle to sql server. Regards ...

Is there any way I can execute this SPROC and get the result with Entity Framework?

This SPROC "returns" a table with two columns: Id, Score. Is it possible to execute this SPROC and include the custom data-type as parameters from within Entity Framework? ALTER PROCEDURE [presenta].[SearchLpi] // The presenta.IdTableType is a table with just one column "Id" @selectedLpis presenta.IdTableType READONLY AS BEGIN...

How can i use my SQL based database software from a remote area with the help of internet.

How can i use my SQL based database software from a remote area with the help of internet. I m using a Sql based database software in my head office to maintain our material flow, like receiving, issue and some other things. Our site office is also doing the same thing. So, is it possible to give our site office access to my Softwa...

Returning a subset of a stored procedure

I have an application that (unfortunately) contains a lot of its business logic is stored procedures. Some of these return masses of data. Occassionally the code will need a small amount of the data returned from the stored procedure. To get a single clients name, I need to call a stored procedure that returns 12 tables and 950 rows. I...

SQL fixed-length insert statement formatter

Lets assume I have this long insert statement insert into table1 (id, name, phone, very_long_col_name, ...) values (1, 'very long name indeed...', '555-555-5555', 1, ...) As you can see above, it gets hard to tell values from their column since their length is uneven I'm looking for something (e.g. command line util) to ...

Query Multiple databases with single ado.net query

I have distributive DB architecture where data is stored in multiple SQL servers. how can i do select/update/delete by running a single query. for example "select * from employees" should return data from all databases i have. How can write single query which run across multiple SQL servers and gets a single consolidated view to my we...

Is LINQ Query Syntax Related to T-SQL Order of Execution?

Does the LINQ syntax match the T-SQL order of execution? I suspect it does and thus the reason for the change in query order between SQL and LINQ but wanted some proof. ...