sql-server

Using ".." in SQL (INSERT INTO X..Y (A) VALUES ('1')

Hi, I am just unsure what use of ".." means. I cannot google it due to characters itself. I think it can be written also that way?: INSERT INTO X.dbo.Y. Or what is it? Thank you ...

Parent Child Record Relationship in SQL?

I need to figure out the best way, in SQL, to query on a Parent / Child relationship. Some of the parent fields will be the data for the child. Here is an example: ID Field1 Field2 ParentId -------------------------------------------- 1 stuff moreStuff 0 2 childStuff (from parent) 1 So, Field...

what is the difference between truncate and delete command in sql query

Possible Duplicate: Whats the difference between TRUNCATE and DELETE in SQL what is the difference between truncate and delete command in sql query ...

Don't understand why these two queries give different results

I have three tables (for sake of argument) individual, email and attribute. individual_Ref the foreign key that links individual to email and attribute. It isn't necessary for a given individual to be represented on the attribute table as they may never have had an attribute added and they can appear more than once if they have more tha...

Moving data from SQL Compact to SQL Server 2008

I have created an .SDF file and inserted data into the SDF database file on a mobile device. I want to transform .SDF file to a SQL Server 2008 Database File but don't know how. Any pointers or suggestions would be appreciated. ...

How do I query SQL Browser Service from Java?

This might be a basic question, but I tried googling it and couldn't find an answer. I need to make a list of all the SQL Servers on a network. This is very easy to do using the .NET framework (System.Data.Sql.SqlDataSourceEnumerator), but is there also a relatively simple way to do this in java as well? While I was doing my research, I...

Which approach would you use for this specific DB Design Issue ?

Just looking for opinions on the following 2 scenarios. We have a table where we store our outbound sms-messages. Everytime one of our services sends a premium rate message, it stores them in this table... to date, all the important information that needs to be stored has been in the same format. SMSMessages ---------------------- ID ...

Microsoft SQL Server email validation

Using Microsoft SQL Server 2005 and above, what code do I use to validate that an email address is correct? Is there an email data type? Is there an email check constraint? Is there an email rule? Is there an email trigger? Is there an email validation stored procedure? ...

Classic ASP, Provider: Type mismatch Error

I have the following ASP code below which is used within a import from a .csv file. I am getting the error on line rs_add_pg_asset_attr("level_3_integer_attribute_description") = rs_get_costs("sp_import_pg_attribute_value") I'm guessing the code is trying to set 2 columns in two different recordsets to be equal to the same thing? Cor...

Which is a better method for storing images - folder or SQL Server as binary?

Hello, I am planning the development of a photo gallery application for a client. I am developing the app in asp.net 3.5 and would like to develop it so that I can re-use the application across multiple platforms using various front-ends. Basically, I am wondering what are the dis-advantages and advantages of storing images in the datab...

Hibernate hbm2ddl and SQL Server: Long as column of numeric data type

Hibernate generates column of type “numeric” in SQL Server for properties of type Long of Java class. Is there a way to make Hibernate generate bigint (or int) column instead of numeric using the Hibernate hbm2ddl? ...

Concatenate rows (sql server 2000)

I have the following problem when using SQL Server 2000 The following table has around 200 rows. Company / Employee 1005 / A 1005 / B 1005 / C 1010 / X 1010 / Y 1020 / L 1020 / M etc etc I wish to create the following (comma separated) output: Company / Employees 1005 / A, B, C 1010 / X, Y 1020 / L, M etc etc I'm having a really...

Find all related records

I have an Order table that has a LinkedOrderID field. I would like to build a query that finds all linked orders and returns them in the result set. select OrderID,LinkOrderID from [Order] where LinkOrderID is not null OrderID LinkOrderID 787016   787037 787037   787786 787786   871702 I would like a stored proc that returns the ...

SQL Server & Mappoint/Spatial Table/Long&Lat

Hi all I am trying to map some data out of MS SQL Server 2008 (express) and Mappoint with the Mappoint addin for Sql server. The only issue i have is this spatial table stuff. I think i understand what a spatial data is now but i just need an example of how to go about cross referencing my states table with its spatial data. so i have a...

Script to start subscribers synchronizing

When I want to force an update of the subscribers to my merge replication publication, I can go into the Replication Monitor, right click on the subscription, and choose Start Synchronizing. I'd like to be able to script this (using vba/vbscript or a command line). I'd also like users to be able to run the script (what permissions woul...

Connect w/ Sql Server Management Studio to an domain server using domain credentials

Hi there, I have a machine that's not connected to a domain and I want to connect to server in that particular domain and I do have proper credentials to log on. I used runas command as follows: runas /netonly /user:domain\domain_username ssms.exe and I was able to connect to the server which otherwise I could not. The weird thing is...

Aggregate data from view as UDF to use in select statement

I have an existing view that returns data in the following format. option_name product_id XSMALL (2-6) 17854 SMALL (6-10) 17854 MEDIUM (10-14) 17854 LARGE 18232 How do I return this data in a comma separated field formatted like this, based on sending a product_id to the function? ...

Errors with SqlQueryNotificationStoredProcedure filled up Sql Server log

My Sql Server logs are filling up at a rapid rate with error messages like the following: The activated proc '[dbo].[SqlQueryNotificationStoredProcedure-b65a194e-e29f-4ba0-8f5a-79f0875bd609]' running on queue 'MyDatabase.dbo.SqlQueryNotificationService-b65a194e-e29f-4ba0-8f5a-79f0875bd609' output the following: 'Cannot execute...

SQL trigger on Truncate

How to Fire a trigger when you do TRUNCATE (instead deleted) in MSSQL ...

Generating a two level hiearchy from a set of data with more then one common grouping field in sql

My database is MS SQL 2008. I"m basically merging some sets of data together from two or more databases to end up with one owner of a set of data possibly related by two fields. Table ID Name Code 1 Ben 1 2 Ben 1 3 Frank 1 4 Frank 2 5 Mark 2 6 Mary 3 7 Chuck 3 8 ...