sql-server

SQL, MVC, Entity Framework

Hi Im using the above technologies and have ran into what I presume is a design issue I have made. I have an Artwork table in my DB and have been able to add art (I now think of these as Digital Products) to a shopping cart + CartLine table fine. The system I have that adds art to galleries and user accounts etc works fine. Now the cl...

Subset sum problem

I'm having a problem with counting which is continuation of this question. I am not really a math person so it's really hard for me to figure out this subset sum problem which was suggested as resolution. I'm having 4 ArrayList in which I hold data: alId, alTransaction, alNumber, alPrice Type | Transaction | Number | Price ...

How to establish secure connection between java application and database?

In an interview, Interview asked me an question : The communication between our application and the remote database must be done with https (more secure). How could you do it? I didn't find any clue for this question in google also. How to establish secure connection between java application and database? Please help me. ...

A 4-byte Unsigned Int for Sql Server 2008?

I understand there are multiple questions about this on SO, but I have yet to find a definitive answer of "yes, here's how..." So here it is again: What are the possible ways to store an unsigned integer value (32-bit value or 32-bit bitmap) into a 4-byte field in SQL Server? Here are ideas I have seen: 1) Use a -1*2^31 offset for al...

Exporting de-aggregated data

I'm currently working on a data export feature for a survey application. We are using SQL2k8. We store data in a normalized format: QuestionId, RespondentId, Answer. We have a couple other tables that define what the question text is for the QuestionId and demographics for the RespondentId... Currently I'm using some dynamic SQL to g...

I'm trying to grasp the concept of creating a program that uses a SQL Server database, but I'm used to running it only on my local machine.

How can I make a program use a SQL Server database, and have that program work on whatever computer it's installed on. If you've been following my string of questions today, you'd know that I'm making an open source and free Help Desk suite for small and medium businesses. The client application. The client application is a Windows ...

Query to return internal details about stored function in SQL Server database

I have been given access to a SQL Server database that is currently used by 3rd party app. As such, I don't have any documentation on how that application stores the data or how it retrieves it. I can figure a few things out based on the names of various tables and the parameters that the user-defined functions takes and returns, but I...

SQL select maximum from two time periods

I have a query, Im trying to select the maximum value from the summer period (nov-april down here) but it only gives me values from nov-dec with this query. Any ideas why? SELECT TOP 10 Value, DateTime FROM history WHERE Tagname = @Tag AND ((DateTime >= @StartYear AND DateTime < @StartWinter) OR (DateTime >= ...

How can I figure out my SQL Server address without having the Management Studio installed?

I have Microsoft SQL Server 2008 installed. It appears in the add/remove programs window. How can I create/delete/alter tables and find the address of my server if I don't have Management Studio installed? I'd like to create the tables and such directly in Visual Studio 2010 premium. ...

Using a temp table in a view

Hi Everyone I would really like to create a view. I know you can't use temp tables in MSSQL2005 views. Without rewriting the sql, is there anything obvious I've missed? Backup plan is to use a stored proc. Cheers select * into #temp from vwIncidents SELECT vwIncidents.incidentcode, employeecode, EMPOS.POS_L4_CDA as areaAtTi...

SQL Server Query Question

Running SQL Server 2008, and I am definitely a new SQL user. I have a table that has 4 columns: EmpNum, User, Action, Updatetime A user logs into, and out of a system, it is registered in the database. For example, if user1 logs into the system, then out 5 minutes later, a simple query (select * from update) would look like: EmpNum...

Retrieve column names of a table into a combo box

Im using c# windows form application. I have a database with many tables. Each table has several columns. I need to populate the combo box with the column names for a selected table. ...

How to deploy vb.net application with database(sqlserver)

How to deploy vb.net application with database(sqlserver) I developed a project on vb.net and used sqlserver as database(has 1 table only). Now i want to make a setup of it so that i could just send the setUp via cd or email and the receiver could easily install the software in his system. I have never deployed or created a setup. Ple...

Select record using GUID

I would like to select a record from my table based on a GUID using the following approach: dim rows() as MyDataSet.MyTableRow = dataset.MyTable.Select("id = " & Guid.NewGuid.ToString) but I get the following exception: System.Data.EvaluateException was unhandled Message="Cannot perform '=' operation on System.Guid and System.Int32. ...

Get all or part result from sql using one TSQL commnd

Hi All Here is my condition. There is a Text box in a form, if you don't input any thing, it would return all rows in this table. If you input something, it would return rows whose Col1 matches the input. I try to use the sql below to do it. But there is one problem, these columns allows Null value. It wouldn't return the row with NULL ...

SQL Server - What coding/development rules does your team have in place?

I asked a similar question last week and didn't get a very good response, so perhaps I didn't phrase the question in the right way. I'd like to know what processes/policies/rules your team has in place for writing T-SQL code and database schema. Here are a couple examples: 1) All foreign key columns should be indexed 2) All primary ke...

Search by nvarchar

Hi all. I have this problem. In table I have column which is nvarcar type. and row in this column is row1= 1;6 row2 = 12 row3 =6;5;67 etc... I try to search this column. for example when i send 1 i try to get only row1. I use LIKE but in result set I get row1 and row2. How can I achieved this, any help is appreciated. Tnx... ...

Best way to get data into an android app?

Hi, Just a little background. I am a proficient asp.net/c#/sql server programmer who has been learning Android for less than 2 days. We have an existing .net website which stores a list of locations in MS SQL server 2008 and I'm trying to create and Android application that gets these locations and displays them on a Google Map. The q...

Stored procedure for selecting multiple records

I need to select records say 2000 from a table with a matching timestamp from c# .net code. Eg: SELECT * FROM ITEMDATA_TABLE WHERE ITEMNAME='Item1' and TimeStamp='2010-04-26 17:15:05.667' The above query has to execute for 2000 items more for the same timestamp. for this we can use SELECT * FROM ITEMDATA_TABLE WHERE ITEMNAME in...

Using IF in T-SQL weakens or breaks execution plan caching?

It has been suggest to me that the use of IF statements in t-SQL batches is detrimental to performance. I'm trying to find some confirmation of this assertion. I'm using SQL Server 2005 and 2008. The assertion is that with the following batch:- IF @parameter = 0 BEGIN SELECT ... something END ELSE BEGIN SELECT ... something e...