Showing posts with the label sql-server-2008

[FIXED] How can I concatinate a subquery result field into the parent query?

Issue DB: Sql Server 2008. I have a really (fake) groovy query like this:- SELECT CarId, Number…

[FIXED] How to get the name of a the student who got max marks in each subject?

Issue I have the following table Name | Subject | Marks -------------------------- a …

[FIXED] How to connect to SQL Server from command prompt with Windows authentication

Issue How can I connect to SQL Server from command prompt using Windows authentication? This comm…

[FIXED] Can you tell me when data was inserted into a table

Issue I am using MS SQL Server 2008 and I have an sql table with some data that is inserted daily a…

[FIXED] How to find diff between two strings in SQL

Issue I have two strings, I want to get difference between contents of two strings in SQL ?? for …

[FIXED] generate fixed number of rows in a table

Issue Not able to word the question properly, so couldn't search what I want. All I need is a d…

[FIXED] When it's necessary to check @@trancount > 0 in try catch block?

Issue Sometimes I saw the following code snippet. When is the if @@trancount > 0 necessary with…

[FIXED] Optimizing Spark JDBC connection read time by adding query parameter

Issue Connecting sql server to spark using the following package noreferrer">https://docs.m…

[FIXED] How to return only the Date from a SQL Server DateTime datatype

Issue SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time …

[FIXED] The transaction log for the database is full

Issue I have a long running process that holds open a transaction for the full duration. I have n…

[FIXED] INSERT INTO SELECT strange order using UNION

Issue I had a typical non-normalized table ( tempTable ) with multiple numbered columns ( rep1 , re…

[FIXED] Compare DATETIME and DATE ignoring time portion

Issue I have two tables where column [date] is type of DATETIME2(0) . I have to compare two reco…

[FIXED] How do I find duplicates across multiple columns?

Issue So I want to do something like this sql code below: select s.id, s.name,s.city from stuff …

[FIXED] concat two integers and result as string in SQL

Issue In table, 2 fields ID as int and Number as small int and i want to concatenate the two fields…

[FIXED] Where we are giving password by using BCP command?

Issue I am pretty much new to bcp but I researched quite a bit and can not find any resource that s…

[FIXED] CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 10240 MB per database

Issue I have SQL Server not Express and when db grows to 10240 I get error: Could not allocate…

[FIXED] Create assembly from two files

Issue According to docs I can specify several files for one assembly: FROM {

[FIXED] Unable to change the password of "sa" in SQL Server 2008

Issue I am trying to change the password of the sa account via SQL Server Management Studio, but i…

[FIXED] How can I pull a list of ID's from a SQL table as a comma-separated values string?

Issue I have to pull a list of integer IDs from a table using only records that match some criteria…

[FIXED] Function should have input parameters?

Issue Is it mandatory to pass input parameters for all the user defined functions? We know, Store…